]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: fix clone coverity scan
authorJohn Chau <john@harmon.hk>
Mon, 17 Aug 2020 07:53:01 +0000 (15:53 +0800)
committerTom Rini <trini@konsulko.com>
Mon, 24 Aug 2020 18:11:31 +0000 (14:11 -0400)
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

index 97747f8f080857e22cd8949280e7286192adf7f9..32473a032c1e254c8c7060abd2e0816b7c9113ee 100644 (file)
@@ -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;