Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

uuid: use prandom_bytes()

Use prandom_bytes() to generate 16 bytes of pseudo-random bytes.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Huang Ying <ying.huang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Akinobu Mita and committed by
Linus Torvalds
cedddb00 3ec39abd

+1 -7
+1 -7
lib/uuid.c
··· 25 25 26 26 static void __uuid_gen_common(__u8 b[16]) 27 27 { 28 - int i; 29 - u32 r; 30 - 31 - for (i = 0; i < 4; i++) { 32 - r = random32(); 33 - memcpy(b + i * 4, &r, 4); 34 - } 28 + prandom_bytes(b, 16); 35 29 /* reversion 0b10 */ 36 30 b[8] = (b[8] & 0x3F) | 0x80; 37 31 }