lxip: get_random_once must be called once

This commit is contained in:
Josef Söntgen 2016-10-20 15:09:37 +02:00 committed by Christian Helmuth
parent d647b6c797
commit ca3be471a9

View File

@ -3188,10 +3188,14 @@ static inline bool ipv4_is_loopback(__be32 addr)
void get_random_bytes(void *buf, int nbytes); void get_random_bytes(void *buf, int nbytes);
static inline void get_random_once(void *buf, int nbytes) #define get_random_once(buf, nbytes) \
{ ({ \
return get_random_bytes(buf, nbytes); static bool initialized = false; \
} if (!initialized) { \
get_random_bytes((buf), (nbytes)); \
initialized = true; \
} \
})
u32 prandom_u32(void); u32 prandom_u32(void);