From 4a1f0b80adfc9465e8a3efcb884d397e5ab7f07f Mon Sep 17 00:00:00 2001 From: John Chau Date: Mon, 17 Aug 2020 15:53:01 +0800 Subject: [PATCH] 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 --- cmd/clone.c | 8 +++++--- 1 file 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; -- 2.39.5