LF-3626: mtd: nand: gpmi: fix the explicit null dereference issue
authorHan Xu <han.xu@nxp.com>
Wed, 31 Mar 2021 19:47:55 +0000 (14:47 -0500)
committerHan Xu <han.xu@nxp.com>
Wed, 5 May 2021 03:25:52 +0000 (22:25 -0500)
commitd092f5fb56a8a873f1d7fdf0213d006f35aa7ebf
treea9115fbdb66d7282764bcf72b91292a19e76370a
parent54e0c53a3823a7d46e0b7d8e03acbea2ad42128a
LF-3626: mtd: nand: gpmi: fix the explicit null dereference issue

A potiential null pointer dereference issue may occur in
gpmi_nfc_exec_op(), found by coverity, CID 9000785.

In the for loop, if loop continues in NAND_OP_CMD_INSTR case, the desc
pointer may leave as null, so move the pointer sanity check outside the
loop.

Signed-off-by: Han Xu <han.xu@nxp.com>
Reviewed-by: Frank Li <frank.li@nxp.com>
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c