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 <vmartirosyan@linuxtesting.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
Vahram Martirosyan 2012-11-28 12:44:16 -05:00 committed by Theodore Ts'o
parent 06348679c9
commit 766f44d46a
1 changed files with 0 additions and 1 deletions

View File

@ -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;