OK deraadt, sort of.

While I'm here I'd like to point out that a hilarious discussion in
regards to glibc's 64-bit time_t support, which is adding manual pads
the middle of standardized structs leading to mis-initialization.

https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#struct_timespec

Anyways I think it is better if you use this format:

enqueue_randomness(u_int val)
{
        struct rand_event *rep;
        struct timespec ts;
        u_int qlen;
 
+       timespecclear(&ts);
        if (timeout_initialized(&rnd_timeout))


Tobias Heider <[email protected]> wrote:

> Hi,
> 
> if timeout_initialized() returns 0, enqueue_randomness() may use 'ts'
> uninitialized.  This is not really a problem because the value is
> blended with other collected entropy.  To make things clearer
> I would still prefer to always initialize 'ts'.
> 
> ok?
> 
> Index: rnd.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/rnd.c,v
> retrieving revision 1.203
> diff -u -p -r1.203 rnd.c
> --- rnd.c     2 Mar 2020 22:27:50 -0000       1.203
> +++ rnd.c     6 Mar 2020 14:57:20 -0000
> @@ -296,7 +296,7 @@ void
>  enqueue_randomness(u_int val)
>  {
>       struct rand_event *rep;
> -     struct timespec ts;
> +     struct timespec ts = { 0, 0 };
>       u_int qlen;
>  
>       if (timeout_initialized(&rnd_timeout))

Reply via email to