[EXT] Re: [PATCH] mtd: rawnand: gpmi: Fix possible NULL pointer dereference in gpmi_nfc_exec_op()

Miquel Raynal miquel.raynal at bootlin.com
Mon Nov 16 08:12:14 PST 2026


Hi Stefan,

On 05/11/2026 at 10:49:48 GMT, Stefan Ghetu <stefan.ghetu at nxp.com> wrote:

> Hi,
>
> The review is right.
>
> Moving the !desc check out of the loop lets the loop continue after an
> intermediate gpmi_chain_() failure. That can submit a truncated DMA
> chain and, once get_next_transfer() has returned NULL, index past
> this->transfers[] both in the loop and in the unmap cleanup.
> The original concern does not seem reachable either:
>
> * the continue in the NAND_OP_CMD_INSTR case only happens when the next
>  instruction is NAND_OP_ADDR_INSTR, which sets and checks desc;
> * a zero-length NAND_OP_DATA_IN_INSTR only breaks out of the switch, so
>  the existing in-loop check still catches desc == NULL;
> * the core helpers drop zero-length data instructions (or reject them
>  with -EINVAL), so ->exec_op() never gets an operation without
>
> So the Coverity report looks like a false positive and the current code
> is correct.
>
> Please drop this patch.

Ok, thanks a lot for the feedback.

Miquèl



More information about the linux-mtd mailing list