[PATCH mtd-utils 3/7] misc-utils: flashcp: Fix uninitialized variable ‘wrlast_buf’ compiling warning
Zhihao Cheng
chengzhihao1 at huawei.com
Sat Jan 25 22:41:59 PST 2025
The compiler compains following message:
misc-utils/flashcp.c:439:3: warning: ‘wrlast_buf’ may be used
uninitialized in this function
It won't bring any problems because variable '‘wrlast_buf’ is always
initialized before being used. Fix the warning by setting 'wrlast_buf'
as NULL when declaring it.
Signed-off-by: Zhihao Cheng <chengzhihao1 at huawei.com>
---
misc-utils/flashcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc-utils/flashcp.c b/misc-utils/flashcp.c
index 9c48637..6065a8c 100644
--- a/misc-utils/flashcp.c
+++ b/misc-utils/flashcp.c
@@ -221,7 +221,7 @@ int main (int argc,char *argv[])
struct mtd_info_user mtd;
struct erase_info_user erase;
struct stat filestat;
- unsigned char *src,*dest,*wrlast_buf;
+ unsigned char *src, *dest, *wrlast_buf = NULL;
unsigned long long wrlast_len = 0;
int error = 0;
--
2.13.6
More information about the linux-mtd
mailing list