On Wed, Apr 17, 2013 at 20:06, Ted Unangst wrote:

> +#define      XSIMPLEQ_INIT(head) do {                                        
> \
> +     (head)->sqx_cookie = arc4random();                              \
> +     if (sizeof(unsigned long) == 8)                                 \
> +             (head)->sqx_cookie |= ((unsigned long)arc4random()) << 
> sizeof(long) * 4;        \

Since a few people have noticed, there was a reason why I didn't use
arc4random_buf here. Unfortunately, I have forgotten what that reason
is. But I did discover people are at least skimming the diff, so maybe
my plan worked after all. In any case, yes, arc4random_buf would be a
better option here.

Along those lines, one thing I forgot to mention is that this diff is
of course only effective if the random generator is operational. pool
keeps many free lists and initializes them late, so it's safe, but
malloc initializes its lists very early, so the cookies are likely to
be fixed values. There's a way to correct that, but it's not critical
for the first iteration.

Reply via email to