On 2023/11/8 20:38, zangyangyang1 wrote:
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 <zangyangya...@xiaomi.com>
---
lib/libf2fs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 995e42d..0398c52 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -933,6 +933,7 @@ int get_device_info(int i)
stat_buf = malloc(sizeof(struct stat));
Use calloc() instead of malloc()?
Thanks,
ASSERT(stat_buf);
+ memset(stat_buf, 0, sizeof(struct stat));
if (!c.sparse_mode) {
if (stat(dev->path, stat_buf) < 0 ) {
--
2.40.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel