]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ext2: use get_random_u32() where appropriate
authorDavid Carlier <devnexen@gmail.com>
Sun, 5 Apr 2026 15:47:17 +0000 (16:47 +0100)
committerJan Kara <jack@suse.cz>
Tue, 7 Apr 2026 11:19:53 +0000 (13:19 +0200)
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>
Link: https://patch.msgid.link/20260405154717.4705-1-devnexen@gmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
fs/ext2/super.c

index 603f2641fe10e558d51a87ee551f892dc4cfc85c..e4136490c8835223cd6743e6144adf06a9b2097e 100644 (file)
@@ -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 */