All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cmd: fix clone coverity scan
@ 2020-08-17  7:53 John Chau
  2020-08-25 12:15 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: John Chau @ 2020-08-17  7:53 UTC (permalink / raw)
  To: u-boot

From: John Chau <john@harmon.hk>

This patch fixes coverity scan MISSING_BREAK issues, and also an error
on block size check.

Signed-off-by: John Chau <john@harmon.hk>
---

 cmd/clone.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/cmd/clone.c b/cmd/clone.c
index 9ece465537..89fa63eb72 100644
--- a/cmd/clone.c
+++ b/cmd/clone.c
@@ -37,7 +37,7 @@ static int do_clone(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	srcbz = srcdesc->blksz;
 	destbz = destdesc->blksz;
 
-	if ((srcbz * (buffersize / srcbz) != buffersize) &&
+	if ((srcbz * (buffersize / srcbz) != buffersize) ||
 	    (destbz * (buffersize / destbz) != buffersize)) {
 		printf("failed: cannot match device block sizes\n");
 		return 1;
@@ -54,10 +54,12 @@ static int do_clone(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		switch (unit[0]) {
 		case 'g':
 		case 'G':
-			requested *= 1024;
+			requested *= 1024 * 1024 * 1024;
+			break;
 		case 'm':
 		case 'M':
-			requested *= 1024;
+			requested *= 1024 * 1024;
+			break;
 		case 'k':
 		case 'K':
 			requested *= 1024;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] cmd: fix clone coverity scan
  2020-08-17  7:53 [PATCH] cmd: fix clone coverity scan John Chau
@ 2020-08-25 12:15 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2020-08-25 12:15 UTC (permalink / raw)
  To: u-boot

On Mon, Aug 17, 2020 at 03:53:01PM +0800, John Chau wrote:

> From: John Chau <john@harmon.hk>
> 
> This patch fixes coverity scan MISSING_BREAK issues, and also an error
> on block size check.
> 
> Signed-off-by: John Chau <john@harmon.hk>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200825/b8af883c/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-25 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17  7:53 [PATCH] cmd: fix clone coverity scan John Chau
2020-08-25 12:15 ` Tom Rini

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.