]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r318511
authortruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 25 May 2017 17:23:26 +0000 (17:23 +0000)
committertruckman <truckman@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 25 May 2017 17:23:26 +0000 (17:23 +0000)
commit001a6f2dea24a1b2e378ece1b36914edcdf207b5
tree19e78b6367447e6e1056eb93b0bbb6800de7a78c
parent050dd4667ab280bf509073e699289751a88e6137
MFC r318511

The result of right shifting a negative signed value is implementation
defined.  On machines without arithmetic shift instructions, zero bits
may be shifted in from the left, giving a large positive result instead
of the desired divide-by power-of-2.  Fix this by operating on the
absolute value and compensating for the possible negation later.

Reverse the order of the underflow/overflow tests and the exponential
decay calculation to avoid the possibility of an erroneous overflow
detection if p is a sufficiently small non-negative value.  Also
check for negative values of prob before doing the exponential decay
to avoid another instance of of right shifting a negative value.

Tested by: Rasool Al-Saadi <ralsaadi@swin.edu.au>

git-svn-id: svn://svn.freebsd.org/base/stable/10@318886 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/netpfil/ipfw/dn_aqm_pie.c
sys/netpfil/ipfw/dn_sched_fq_pie.c