ubi: some invalid code in the function scan_peb
Zhihao Cheng
chengzhihao1 at huawei.com
Tue Oct 17 23:31:03 PDT 2023
在 2023/10/18 13:59, Ryder Wang 写道:
> 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).
>
Yes, redundant checking indeed exists in scan_peb(), could you send a
patch to clean it up?
More information about the linux-mtd
mailing list