1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-17 15:27:36 +00:00

- Cast the intermediate value in priority computtion back down to

unsigned char.  Weirdly, casting the 1 constant to u_char still produces
   a signed integer result that is then used in the % computation.  This
   avoids that mess all together and causes a 0 pri to turn into 255 % 64
   as we expect.

Reported by:	kkenn (about 4 times, thanks)
This commit is contained in:
Jeff Roberson 2007-03-17 18:13:32 +00:00
parent 42a3b81e4e
commit 4499aff6ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167664

View File

@ -388,7 +388,7 @@ tdq_runq_add(struct tdq *tdq, struct td_sched *ts, int flags)
*/
if (tdq->tdq_ridx != tdq->tdq_idx &&
pri == tdq->tdq_ridx)
pri = (pri - 1) % RQ_NQS;
pri = (unsigned char)(pri - 1) % RQ_NQS;
} else
pri = tdq->tdq_ridx;
runq_add_pri(ts->ts_runq, ts, pri, flags);