* [PATCH] misc-utils: flashcp: correct casting for percent display
@ 2023-04-22 7:31 cchoux
2023-04-24 1:48 ` Zhihao Cheng
0 siblings, 1 reply; 3+ messages in thread
From: cchoux @ 2023-04-22 7:31 UTC (permalink / raw)
To: linux-mtd; +Cc: cosmo.chou, cchoux
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>
---
misc-utils/flashcp.c | 4 ++--
1 file 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);
--
2.25.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] misc-utils: flashcp: correct casting for percent display
2023-04-22 7:31 [PATCH] misc-utils: flashcp: correct casting for percent display cchoux
@ 2023-04-24 1:48 ` Zhihao Cheng
2023-04-24 7:04 ` David Oberhollenzer
0 siblings, 1 reply; 3+ messages in thread
From: Zhihao Cheng @ 2023-04-24 1:48 UTC (permalink / raw)
To: cchoux, linux-mtd; +Cc: cosmo.chou
在 2023/4/22 15:31, cchoux 写道:
> 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>
> ---
> misc-utils/flashcp.c | 4 ++--
> 1 file 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);
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] misc-utils: flashcp: correct casting for percent display
2023-04-24 1:48 ` Zhihao Cheng
@ 2023-04-24 7:04 ` David Oberhollenzer
0 siblings, 0 replies; 3+ messages in thread
From: David Oberhollenzer @ 2023-04-24 7:04 UTC (permalink / raw)
To: Zhihao Cheng, cchoux, linux-mtd; +Cc: cosmo.chou
Applied to mtd-utils.git master.
Thanks,
David
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-24 7:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-22 7:31 [PATCH] misc-utils: flashcp: correct casting for percent display cchoux
2023-04-24 1:48 ` Zhihao Cheng
2023-04-24 7:04 ` David Oberhollenzer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.