]> www.infradead.org Git - mtd-utils.git/commitdiff
misc-utils: flashcp: Fix uninitialized variable ‘wrlast_buf’ compiling warning
authorZhihao Cheng <chengzhihao1@huawei.com>
Sun, 26 Jan 2025 06:41:59 +0000 (14:41 +0800)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Thu, 30 Jan 2025 17:30:16 +0000 (18:30 +0100)
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@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
misc-utils/flashcp.c

index 9c48637fb3f10dd7d82cc32d165505359580e4a1..6065a8ca75a1970efbceb7029dd1afdf2a6119f4 100644 (file)
@@ -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;