On Thu, 2011-09-01 at 16:35 +0100, Dave Shield wrote:
> The hardware-based implementation of the UCD disk table
> (ucd-snmp/disk_hw) in v5.6 and above can suffer from
> arithmetic overflow when calculating percentage usage
> on large disks.
> The following simple patch should address this problem:
>
> --- a/agent/mibgroup/ucd-snmp/disk_hw.c
> +++ b/agent/mibgroup/ucd-snmp/disk_hw.c
> @@ -248,7 +248,7 @@ static int _percent( unsigned long long value,
> unsigned long long total ) {
> /* avoid division by zero */
> if (total == 0)
> return 0;
> - return (int)( value * 100 / total );
> + return (int)( value / (total/100) );
Can total be less than 100? In that case I'd say -1 as divide by zero is
bad.
/MF
> }
>
> static netsnmp_fsys_info **
>
>
>
>
> I'd like to see this included in 5.7.1
> Votes please....
>
> Dave
>
> ------------------------------------------------------------------------------
> Special Offer -- Download ArcSight Logger for FREE!
> Finally, a world-class log management solution at an even better
> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> download Logger. Secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsisghtdev2dev
> _______________________________________________
> Net-snmp-coders mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders