uuid: use prandom_bytes()
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 29 Apr 2013 23:21:25 +0000 (16:21 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 30 Apr 2013 01:28:42 +0000 (18:28 -0700)
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>
lib/uuid.c

index 52a6fe6..398821e 100644 (file)
 
 static void __uuid_gen_common(__u8 b[16])
 {
-       int i;
-       u32 r;
-
-       for (i = 0; i < 4; i++) {
-               r = random32();
-               memcpy(b + i * 4, &r, 4);
-       }
+       prandom_bytes(b, 16);
        /* reversion 0b10 */
        b[8] = (b[8] & 0x3F) | 0x80;
 }