cmd: ubi: remove unnecessary logical constraint
authorxypron.glpk@gmx.de <xypron.glpk@gmx.de>
Sat, 15 Apr 2017 14:25:25 +0000 (16:25 +0200)
committerHeiko Schocher <hs@denx.de>
Tue, 18 Apr 2017 04:08:32 +0000 (06:08 +0200)
A size_t variable can never be negative.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
cmd/ubi.c

index efc43ffde91ec5863adfc3382087afcca5358ba9..222be5a3576cb7aa96121b449889766550d1885d 100644 (file)
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -308,7 +308,7 @@ int ubi_volume_begin_write(char *volume, void *buf, size_t size,
                return ENODEV;
 
        rsvd_bytes = vol->reserved_pebs * (ubi->leb_size - vol->data_pad);
-       if (size < 0 || size > rsvd_bytes) {
+       if (size > rsvd_bytes) {
                printf("size > volume size! Aborting!\n");
                return EINVAL;
        }