[hobbit] overflow in netbsd-meminfo.c

Rich Smrcina rsmrcina at wi.rr.com
Thu Nov 13 12:25:05 CET 2008


You posted this last night:

    Memory              Used       Total  Percentage
  Physical     4294963639M 4294966523M          0%
  Swap                  0M       4098M          0%

It appears that Hobbit is reading the 'physical' line, therefore causing the negative 
value in meminfo.  If you have 4G of memory on your machine, the value is clearly wrong, 
so the error is in netbsd.  Changing the Hobbit code isn't fixing the problem, it just 
makes the value more readable... :)  Hobbit will still reflect a wrong memory value.

Tracy Di Marco White wrote:
> On Wed, Nov 12, 2008 at 10:43 PM, Rich Smrcina <rsmrcina at wi.rr.com> wrote:
> 
> It looks like the problem is this, then?
> # sysctl -a|grep physmem
> hw.physmem = -537526272
> hw.physmem64 = 3757441024
> 
> But if hobbit is using a signed int, which it does seem to be here, I
> don't see how hobbit could get it anything but wrong when there's more
> than 2 GB of RAM.
> Given this code, that's my understanding:
>    25 	int physmem;
>    67 	printf("Total:%d\n", (physmem / (1024 * 1024)));
> 
> So is this also a bug in FreeBSD, as they are also using an unsigned
> long, for this and for pagesize?
> 
> Could you help me understand why you say this is a bug in NetBSD?
> 
> -Tracy
> 
> To unsubscribe from the hobbit list, send an e-mail to
> hobbit-unsubscribe at hswn.dk
> 
> 
> 


-- 
Rich Smrcina
VM Assist, Inc.
Phone: 414-491-6001
Ans Service:  360-715-2467
http://www.linkedin.com/in/richsmrcina

Catch the WAVV!  http://www.wavv.org
WAVV 2009 - Orlando, FL - May 15-19, 2009



More information about the Xymon mailing list