ubi: some invalid code in the function scan_peb

Ryder Wang rydercoding at hotmail.com
Tue Oct 17 22:59:07 PDT 2023


I just find some dead code in the function scan_peb in drvier/mtd/ubi/attach.c.

In the function scan_peb, it calls validate_ec_hdr which calls validate_ec_hdr. If ubi version or erase count is incorrect, it will report -EINVAL and abort the function scan_peb. However, ubi version or erase count will be checked again in scan_peb and such check code will never find the errors because such errors should have been detected by validate_ec_hdr (aborting).

Thanks,
Ryder


More information about the linux-mtd mailing list