lkml.org 
[lkml]   [2020]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[RFC PATCH v1 41/50] drivers/block/drbd/drbd_nl.c: Use get_random_u64()
There's no need to get_random_bytes() into a temporary buffer.

This is not a no-brainer change; get_random_u64() has slightly
weaker security guarantees, but they're fine for applications
like these where the random value is stored in the kernel for
as long as it's valuable.

Signed-off-by: George Spelvin <lkml@sdf.org>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: drbd-dev@lists.linbit.com
---
drivers/block/drbd/drbd_nl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index de2f94d0103a6..ca8c706d47f3a 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -3223,9 +3223,7 @@ int drbd_adm_resume_io(struct sk_buff *skb, struct genl_info *info)
* the refuse to re-connect or re-attach (because no
* matching real data uuid exists).
*/
- u64 val;
- get_random_bytes(&val, sizeof(u64));
- drbd_set_ed_uuid(device, val);
+ drbd_set_ed_uuid(device, get_random_u64());
drbd_warn(device, "Resumed without access to data; please tear down before attempting to re-configure.\n");
}
clear_bit(NEW_CUR_UUID, &device->flags);
--
2.26.0
\
 
 \ /
  Last update: 2020-03-28 17:47    [W:0.025 / U:2.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site