From a2f6201c501035ec02634b2fa7d261b003ec26bb Mon Sep 17 00:00:00 2001 From: cchoux Date: Sat, 22 Apr 2023 15:31:15 +0800 Subject: misc-utils: flashcp: correct casting for percent display Add correct casting for written to prevent overflow that size_t is only 32 bits on a 32-bit platform. Signed-off-by: cchoux Reviewed-by: Zhihao Cheng Signed-off-by: David Oberhollenzer --- misc-utils/flashcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'misc-utils') diff --git a/misc-utils/flashcp.c b/misc-utils/flashcp.c index 2e8d4c1..50f8c04 100644 --- a/misc-utils/flashcp.c +++ b/misc-utils/flashcp.c @@ -371,7 +371,7 @@ int main (int argc,char *argv[]) log_verbose ("\rWriting data: %dk/%lluk (%llu%%)", KB (written + i), KB ((unsigned long long)filestat.st_size), - PERCENTAGE (written + i,(unsigned long long)filestat.st_size)); + PERCENTAGE ((unsigned long long)written + i,(unsigned long long)filestat.st_size)); /* read from filename */ safe_read (fil_fd,filename,src,i); @@ -403,7 +403,7 @@ int main (int argc,char *argv[]) log_verbose ("\rVerifying data: %luk/%lluk (%llu%%)", KB (written + i), KB ((unsigned long long)filestat.st_size), - PERCENTAGE (written + i,(unsigned long long)filestat.st_size)); + PERCENTAGE ((unsigned long long)written + i,(unsigned long long)filestat.st_size)); /* read from filename */ safe_read (fil_fd,filename,src,i); -- cgit v1.2.3