Skip to content

Commit

Permalink
ext4: fixed potential NULL dereference in ext4_calculate_overhead()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vahram Martirosyan authored and Theodore Ts'o committed Nov 28, 2012
1 parent 0634867 commit 766f44d
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 766f44d

Please sign in to comment.