All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] ext2: use get_random_u32() where appropriate
@ 2026-04-05 15:47 David Carlier
  2026-04-07 11:18 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: David Carlier @ 2026-04-05 15:47 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-ext4, 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>
---
 fs/ext2/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 603f2641fe10..e4136490c883 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1151,7 +1151,7 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
 		goto failed_mount2;
 	}
 	sbi->s_gdb_count = db_count;
-	get_random_bytes(&sbi->s_next_generation, sizeof(u32));
+	sbi->s_next_generation = get_random_u32();
 	spin_lock_init(&sbi->s_next_gen_lock);
 
 	/* per filesystem reservation list head & lock */
-- 
2.53.0


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

* Re: [PATCH v3] ext2: use get_random_u32() where appropriate
  2026-04-05 15:47 [PATCH v3] ext2: use get_random_u32() where appropriate David Carlier
@ 2026-04-07 11:18 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2026-04-07 11:18 UTC (permalink / raw)
  To: David Carlier; +Cc: Jan Kara, linux-ext4, linux-kernel

On Sun 05-04-26 16:47:17, 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>

Thanks! I've added the patch to my tree.

								Honza

> ---
>  fs/ext2/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index 603f2641fe10..e4136490c883 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -1151,7 +1151,7 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
>  		goto failed_mount2;
>  	}
>  	sbi->s_gdb_count = db_count;
> -	get_random_bytes(&sbi->s_next_generation, sizeof(u32));
> +	sbi->s_next_generation = get_random_u32();
>  	spin_lock_init(&sbi->s_next_gen_lock);
>  
>  	/* per filesystem reservation list head & lock */
> -- 
> 2.53.0
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

end of thread, other threads:[~2026-04-07 11:18 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] ext2: use get_random_u32() where appropriate David Carlier
2026-04-07 11:18 ` Jan Kara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.