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) );
 }

 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
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to