提交 766f44d4 编写于 作者: V Vahram Martirosyan 提交者: Theodore Ts'o

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: NVahram Martirosyan <vmartirosyan@linuxtesting.org>
Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
上级 06348679
...@@ -3206,7 +3206,6 @@ int ext4_calculate_overhead(struct super_block *sb) ...@@ -3206,7 +3206,6 @@ int ext4_calculate_overhead(struct super_block *sb)
ext4_fsblk_t overhead = 0; ext4_fsblk_t overhead = 0;
char *buf = (char *) get_zeroed_page(GFP_KERNEL); char *buf = (char *) get_zeroed_page(GFP_KERNEL);
memset(buf, 0, PAGE_SIZE);
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册