summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2013-04-29 16:21:25 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 18:28:42 -0700
commitcedddb00023b1321f2bb2739739aa8c9927fc063 (patch)
tree425bb1e104ffd4693b28076ee35bcad8f7fbfcd9 /lib
parent3ec39abdcc0d3099e8d8894dcbcc8c9490ee48e2 (diff)
downloadlinux-cedddb00023b1321f2bb2739739aa8c9927fc063.tar.gz
linux-cedddb00023b1321f2bb2739739aa8c9927fc063.tar.bz2
linux-cedddb00023b1321f2bb2739739aa8c9927fc063.zip
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/uuid.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/uuid.c b/lib/uuid.c
index 52a6fe6387de..398821e4dce1 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -25,13 +25,7 @@
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;
}