From 766f44d46a726cb59f52a75c5c87425a10c4bade Mon Sep 17 00:00:00 2001 From: Vahram Martirosyan Date: Wed, 28 Nov 2012 12:44:16 -0500 Subject: [PATCH] ext4: fixed potential NULL dereference in ext4_calculate_overhead() The memset operation before check can cause a BUG if the memory allocation failed. Since we are using get_zeroed_age, there is no need to use memset anyway. Found by the Spruce system in cooperation with the KEDR Framework. Signed-off-by: Vahram Martirosyan Signed-off-by: "Theodore Ts'o" --- fs/ext4/super.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ad6cd8aeb946..66a4e20424cf 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3206,7 +3206,6 @@ int ext4_calculate_overhead(struct super_block *sb) ext4_fsblk_t overhead = 0; char *buf = (char *) get_zeroed_page(GFP_KERNEL); - memset(buf, 0, PAGE_SIZE); if (!buf) return -ENOMEM; -- 2.39.5