]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mtd: ubi: Remove test that always fails
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Fri, 1 Aug 2025 11:49:48 +0000 (12:49 +0100)
committerHeiko Schocher <hs@nabladev.com>
Wed, 8 Oct 2025 09:34:12 +0000 (11:34 +0200)
When checking the VID header of a static volume there is an early test
for data_size == 0 so testing for that condition again is guaranteed to
fail. Just remove this piece of code.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/mtd/ubi/io.c

index 45699b4a4778d92f573426c63fcc1c06e0b911c2..2ec968c85ffd9cfff14b27c2d8a6fea1e9b63372 100644 (file)
@@ -936,12 +936,7 @@ static int validate_vid_hdr(const struct ubi_device *ubi,
                                ubi_err(ubi, "bad data_size");
                                goto bad;
                        }
-               } else if (lnum == used_ebs - 1) {
-                       if (data_size == 0) {
-                               ubi_err(ubi, "bad data_size at last LEB");
-                               goto bad;
-                       }
-               } else {
+               } else if (lnum != used_ebs - 1) {
                        ubi_err(ubi, "too high lnum");
                        goto bad;
                }