mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-08 14:16:12 +02:00
mtd: nand: Prevent dereference of NULL pointer
In nand_wait_ready there is a loop that includes a NULL check for chip->dev_ready before it is dereferenced. Use a NULL check once the loop is exited as well to cover the case where it exits due to a timeout and it is therefore not known if chip->dev_ready is NULL or not. This issue found by Smatch. Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
This commit is contained in:
parent
ce1bdedd2f
commit
a5c83da3cc
@ -566,7 +566,7 @@ void nand_wait_ready(struct mtd_info *mtd)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!chip->dev_ready(mtd))
|
||||
if (!chip->dev_ready || !chip->dev_ready(mtd))
|
||||
pr_warn("timeout while waiting for chip to become ready\n");
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nand_wait_ready);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user