From: Zhihao Cheng Date: Sun, 26 Jan 2025 06:41:59 +0000 (+0800) Subject: misc-utils: flashcp: Fix uninitialized variable ‘wrlast_buf’ compiling warning X-Git-Tag: v2.3.0~6 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=555a652dfe40619fd316ff7016570734450daf44;p=mtd-utils.git misc-utils: flashcp: Fix uninitialized variable ‘wrlast_buf’ compiling warning 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 Signed-off-by: David Oberhollenzer --- 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;