Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/sys/altq



Module Name:    src
Committed By:   ozaki-r
Date:           Mon Feb  3 07:40:24 UTC 2025

Modified Files:
        src/sys/altq: altq_rmclass.h

Log Message:
altq, cbq: fix TS_ADD_DELTA on ILP32

TS_ADD_DELTA adds a nanosecond value, delta, to a timespec value while
delta is int64_t and tv_nsec is long.  delta is guaranteed as positive
in ALTQ/CBQ.  However, the original code used delta after casting it
into long.  So it could be negative on ILP32 systems.  TS_ADD_DELTA
didn't assume that delta was negative and resulting tv_nsec could be
negative unexpectedly.

This issue was likely to occur when bandwidth borrowing was used where
the borrowing class had a absolutely small bandwidth (e.g., less than
10 Mbps) or a relatively small bandwidth (e.g., 10 Mbps when the parent
class had 200 Mbps).

KASSERT has been added to guarantee resulting tv_nsec is always not
negative.  Additionally, another KASSERT has been added to make it clear
that delta is assumed to be non-negative.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/altq/altq_rmclass.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index