diff options
author | zangyangyang1 <zangyangyang1@xiaomi.com> | 2023-11-09 23:47:42 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2023-11-17 09:26:56 -0800 |
commit | 370d070e02f0954c41906e40a9d505b083b353e1 (patch) | |
tree | 33c2a50b5c2c18532cc904b8694204b6252f79a0 | |
parent | 5e7ebf12784a4e125fcc7310c1188eae690425ba (diff) | |
download | f2fs-tools-370d070e02f0954c41906e40a9d505b083b353e1.tar.gz |
libf2fs: Fix using uninitialized variables error in get_device_info()
This issue comes from a static code scanning tool.
When c.sparse_mode is 1, stat_buf will not be initialized,
but it will be used next.
If this issue does not require modification, please ignore this commit.
Signed-off-by: zangyangyang1 <zangyangyang1@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | lib/libf2fs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libf2fs.c b/lib/libf2fs.c index 995e42d..47d4e49 100644 --- a/lib/libf2fs.c +++ b/lib/libf2fs.c @@ -931,7 +931,7 @@ int get_device_info(int i) } } - stat_buf = malloc(sizeof(struct stat)); + stat_buf = calloc(1, sizeof(struct stat)); ASSERT(stat_buf); if (!c.sparse_mode) { |