cvs commit: src/sys/dev/random randomdev_soft.c

Mark Murray markm at FreeBSD.ORG
Thu Mar 17 23:55:17 PST 2005


Poul-Henning Kamp writes:
> phk         2005-03-18 07:13:35 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/dev/random       randomdev_soft.c 
>   Log:
>   Fix off-by-one (too little!) array size problem.
>   
>   Detected by:    Coverity (ID#661)

Erm, Coverity didn't get this right. The array size is given by the 
last constant in an enum; normally this would be one-too-small, so 
I put an extra thingy in the enum to make a "maxval", which is used 
here.

A later KASSERT incorrectly asserts that the "maxval" is an acceptable
value for the array index, so that possibly added to the confusion.

The correct fix is to fix the KASSERT, and PHK has indicated that he 
won't object to me reversing his commit to sort things out this way.

M
--
Mark Murray
iumop ap!sdn w,I idlaH




More information about the cvs-src mailing list