ubi: remove dead code in validate_vid_hdr()
authorJubin Zhong <zhongjubin@huawei.com>
Sat, 19 Dec 2020 12:49:10 +0000 (20:49 +0800)
committerRichard Weinberger <richard@nod.at>
Fri, 12 Feb 2021 20:53:22 +0000 (21:53 +0100)
data_size is already checked against zero when vol_type matches
UBI_VID_STATIC. Remove the following dead code.

Signed-off-by: Jubin Zhong <zhongjubin@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/io.c

index 2f3312c31e51c18b88dbc3bb63b3cefe064b2513..8a7306cc1947148ddba9b9bd3be3023d7f45cd3d 100644 (file)
@@ -913,12 +913,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;
                }