From 021830ab04abbb3785c3510cf1d4b49e4646087c Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Wed, 5 Mar 2025 15:48:07 -0800 Subject: [PATCH] If kzalloc fails, avoid NULL deref. We still assign NULL to sbi->s_fs_info to aid checks in cleanup paths. Signed-off-by: Auke Kok --- kmod/src/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmod/src/super.c b/kmod/src/super.c index 16ab2343..3c837160 100644 --- a/kmod/src/super.c +++ b/kmod/src/super.c @@ -512,9 +512,9 @@ static int scoutfs_fill_super(struct super_block *sb, void *data, int silent) sbi = kzalloc(sizeof(struct scoutfs_sb_info), GFP_KERNEL); sb->s_fs_info = sbi; - sbi->sb = sb; if (!sbi) return -ENOMEM; + sbi->sb = sb; ret = assign_random_id(sbi); if (ret < 0)