Skip to contentSkip to conversation

cmd: fix clone coverity scan

PATCH New John Chau 2 participants 2 messages Aug 17, 2020 – Aug 25, 2020

lore
Share & tools
lore

John Chau

author
#0 lore raw

PATCH 1/1 cmd: fix clone coverity scan

From: John Chau <[email protected]>

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

---

 cmd/clone.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
cmd/clone.c +5 -3
index 9ece465537..89fa63eb72 100644
@@ -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;
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 cmd: fix clone coverity scan

Quoted 6 lines · John Chau

From: John Chau <[email protected]>

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

Applied to u-boot/master, thanks!

Signature · 8 lines
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>