- 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 2007-03-17 18:13:32 +00:00
parent 1008dd40e3
commit 82143f95ad

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