Don't overflow from the gigabyte scale to the bit scale if the
number to auto-scale is >= 1024 Gb. Could be triggered on arches where ifdata counters had 64 bits. Reported by: Miroslav Slavkov on -net MFC after: 3 days
This commit is contained in:
parent
cb3b333294
commit
a3736d312c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=164636
@ -69,7 +69,7 @@ get_tbl_ptr(const u_long size, const u_int scale)
|
||||
* index as the array index into the conversion table.
|
||||
*/
|
||||
for (tmp = size, idx = SC_KILOBYTE;
|
||||
tmp >= MEGA && idx <= SC_GIGABYTE;
|
||||
tmp >= MEGA && idx < SC_GIGABYTE;
|
||||
tmp >>= 10, idx++);
|
||||
|
||||
tbl_ptr = &convtbl[idx];
|
||||
|
Loading…
Reference in New Issue
Block a user