public inbox for dm-devel@redhat.com
 help / color / mirror / Atom feed
* [PATCH v3] dm vdo: use get_random_u32() where appropriate
@ 2026-04-05 15:47 David Carlier
  2026-04-06 21:14 ` Matthew Sakai
  0 siblings, 1 reply; 2+ messages in thread
From: David Carlier @ 2026-04-05 15:47 UTC (permalink / raw)
  To: Matthew Sakai; +Cc: dm-devel, linux-kernel, David Carlier

Use the typed random integer helpers instead of
get_random_bytes() when filling a single integer variable.
The helpers return the value directly, require no pointer
or size argument, and better express intent.

Signed-off-by: David Carlier <devnexen@gmail.com>
---
 drivers/md/dm-vdo/indexer/index-layout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-vdo/indexer/index-layout.c b/drivers/md/dm-vdo/indexer/index-layout.c
index 61edf2b72427..8707930c9910 100644
--- a/drivers/md/dm-vdo/indexer/index-layout.c
+++ b/drivers/md/dm-vdo/indexer/index-layout.c
@@ -256,7 +256,7 @@ static void create_unique_nonce_data(u8 *buffer)
 	u32 rand;
 	size_t offset = 0;
 
-	get_random_bytes(&rand, sizeof(u32));
+	rand = get_random_u32();
 	memcpy(buffer + offset, &now, sizeof(now));
 	offset += sizeof(now);
 	memcpy(buffer + offset, &rand, sizeof(rand));
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] dm vdo: use get_random_u32() where appropriate
  2026-04-05 15:47 [PATCH v3] dm vdo: use get_random_u32() where appropriate David Carlier
@ 2026-04-06 21:14 ` Matthew Sakai
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Sakai @ 2026-04-06 21:14 UTC (permalink / raw)
  To: David Carlier; +Cc: dm-devel, linux-kernel


On 4/5/26 11:47 AM, David Carlier wrote:
> Use the typed random integer helpers instead of
> get_random_bytes() when filling a single integer variable.
> The helpers return the value directly, require no pointer
> or size argument, and better express intent.
> 
> Signed-off-by: David Carlier <devnexen@gmail.com>

Reviewed-by: Matthew Sakai <msakai@redhat.com>

> ---
>   drivers/md/dm-vdo/indexer/index-layout.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-vdo/indexer/index-layout.c b/drivers/md/dm-vdo/indexer/index-layout.c
> index 61edf2b72427..8707930c9910 100644
> --- a/drivers/md/dm-vdo/indexer/index-layout.c
> +++ b/drivers/md/dm-vdo/indexer/index-layout.c
> @@ -256,7 +256,7 @@ static void create_unique_nonce_data(u8 *buffer)
>   	u32 rand;
>   	size_t offset = 0;
>   
> -	get_random_bytes(&rand, sizeof(u32));
> +	rand = get_random_u32();
>   	memcpy(buffer + offset, &now, sizeof(now));
>   	offset += sizeof(now);
>   	memcpy(buffer + offset, &rand, sizeof(rand));


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-06 21:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-05 15:47 [PATCH v3] dm vdo: use get_random_u32() where appropriate David Carlier
2026-04-06 21:14 ` Matthew Sakai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox