NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/38723



Hi,

On Tue, Dec 16, 2008 at 11:40 AM, FUKAUMI Naoki <fun%naobsd.org@localhost> 
wrote:
> The following reply was made to PR bin/38723; it has been noted by GNATS.
>
> From: FUKAUMI Naoki <fun%naobsd.org@localhost>
> To: gnats-bugs%gnats.NetBSD.org@localhost
> Cc: christos%NetBSD.org@localhost
> Subject: Re: bin/38723
> Date: Wed, 17 Dec 2008 01:37:54 +0900
>
>  --Multipart_Wed_Dec_17_01:37:54_2008-1
>  Content-Type: text/plain; charset=US-ASCII
>
>  hi christos,
>
>  you didn't use 2nd patch from paul, so "AMD Power Management features"
>  is still missing. please apply attached patch, and please pullup to
>  netbsd-5.
>
I object. Dynamic allocation should not be needed, CPUID_APM_FLAGS is
way much smaller than MAXPATHLEN and there is no reason to use
MAXPATHLEN just because it is a huge value, the use of this constant
is bogus in this context.

>  [before]
> [...]
>  cpu0: AMD Power Management features:
>  cpu0: family 0f model 02 extfamily 01 extmodel 00
>
>  [after]
> [...]
>  cpu0: AMD Power Management features: 1f9<TS,TTP,HTC,STC,100,HWP,TSC>
>  cpu0: family 0f model 02 extfamily 01 extmodel 00
>
>  --
>  FUKAUMI Naoki
>
>  --Multipart_Wed_Dec_17_01:37:54_2008-1
>  Content-Type: text/plain; charset=US-ASCII
>
>  Index: usr.sbin/cpuctl/arch/i386.c
>  ===================================================================
>  RCS file: /home/fun/cvsroot/NetBSD/src/usr.sbin/cpuctl/arch/i386.c,v
>  retrieving revision 1.13
>  diff -u -p -r1.13 i386.c
>  --- usr.sbin/cpuctl/arch/i386.c        14 Oct 2008 15:49:04 -0000      1.13
>  +++ usr.sbin/cpuctl/arch/i386.c        16 Dec 2008 16:20:51 -0000
>  @@ -1778,7 +1778,7 @@ static void
>  powernow_probe(struct cpu_info *ci)
>  {
>        uint32_t regs[4];
>  -      char line[256];
>  +      char *buf;
>
>        x86_cpuid(0x80000000, regs);
>
>  @@ -1787,7 +1787,10 @@ powernow_probe(struct cpu_info *ci)
>                return;
>        x86_cpuid(0x80000007, regs);
>
>  -      bitmask_snprintf(regs[3], CPUID_APM_FLAGS, line, sizeof(line));
>  +      buf = malloc(MAXPATHLEN);
>  +      bitmask_snprintf(regs[3], CPUID_APM_FLAGS, buf, MAXPATHLEN);
sizeof(CPUID_APM_FLAGS) == 37, including control char. If you include
prefix and suffix added by bitmask_snprintf(9) should should hardly
needed a buffer bigger than 64.

 - Arnaud


Home | Main Index | Thread Index | Old Index