diff options
| author | Qingfang Deng <qingfang.deng@siflower.com.cn> | 2024-07-01 12:52:05 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-12-05 14:03:04 +0100 |
| commit | fb014a3284c43f53e3ff805db8d6b165d8fe586a (patch) | |
| tree | 436ba4a96a04b6c3e1846cbbeaf8aa075fb56d69 /fs/nfs/write.c | |
| parent | 2497479aecebe869d23a0064e0fd1a03e34f0e2a (diff) | |
| download | linux-fb014a3284c43f53e3ff805db8d6b165d8fe586a.tar.gz linux-fb014a3284c43f53e3ff805db8d6b165d8fe586a.tar.bz2 linux-fb014a3284c43f53e3ff805db8d6b165d8fe586a.zip | |
jffs2: fix use of uninitialized variable
[ Upstream commit 3ba44ee966bc3c41dd8a944f963466c8fcc60dc8 ]
When building the kernel with -Wmaybe-uninitialized, the compiler
reports this warning:
In function 'jffs2_mark_erased_block',
inlined from 'jffs2_erase_pending_blocks' at fs/jffs2/erase.c:116:4:
fs/jffs2/erase.c:474:9: warning: 'bad_offset' may be used uninitialized [-Wmaybe-uninitialized]
474 | jffs2_erase_failed(c, jeb, bad_offset);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/jffs2/erase.c: In function 'jffs2_erase_pending_blocks':
fs/jffs2/erase.c:402:18: note: 'bad_offset' was declared here
402 | uint32_t bad_offset;
| ^~~~~~~~~~
When mtd->point() is used, jffs2_erase_pending_blocks can return -EIO
without initializing bad_offset, which is later used at the filebad
label in jffs2_mark_erased_block.
Fix it by initializing this variable.
Fixes: 8a0f572397ca ("[JFFS2] Return values of jffs2_block_check_erase error paths")
Signed-off-by: Qingfang Deng <qingfang.deng@siflower.com.cn>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/nfs/write.c')
0 files changed, 0 insertions, 0 deletions
