summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorJohn Chau <john@harmon.hk>2020-08-17 15:53:01 +0800
committerTom Rini <trini@konsulko.com>2020-08-24 14:11:31 -0400
commit4a1f0b80adfc9465e8a3efcb884d397e5ab7f07f (patch)
tree8bca7b67088cd31bb14c392300fdaae117615e85 /cmd
parent10e4d64e345b6b684d27d3da6ed8d887c8e45f76 (diff)
cmd: fix clone coverity scan
This patch fixes coverity scan MISSING_BREAK issues, and also an error on block size check. Signed-off-by: John Chau <john@harmon.hk>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/clone.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd/clone.c b/cmd/clone.c
index 97747f8f08..32473a032c 100644
--- a/cmd/clone.c
+++ b/cmd/clone.c
@@ -38,7 +38,7 @@ static int do_clone(struct cmd_tbl *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;
@@ -55,10 +55,12 @@ static int do_clone(struct cmd_tbl *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;