summaryrefslogtreecommitdiff
path: root/misc-utils
diff options
context:
space:
mode:
authorcchoux <chou.cosmo@gmail.com>2023-04-22 15:31:15 +0800
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-04-24 09:01:37 +0200
commita2f6201c501035ec02634b2fa7d261b003ec26bb (patch)
tree6c917b03d8719c2f5b0291f358012541fc6fcc2c /misc-utils
parenta61e2d93c7cbfe3d9311349ad789b9e4e9a16105 (diff)
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 <chou.cosmo@gmail.com> Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/flashcp.c4
1 files changed, 2 insertions, 2 deletions
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);