All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] mtd: rawnand: allocate dynamically ONFI parameters during detection
@ 2018-07-31 18:26 Dan Carpenter
  2018-08-01  6:56 ` Miquel Raynal
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-07-31 18:26 UTC (permalink / raw)
  To: miquel.raynal; +Cc: linux-mtd

Hello Miquel Raynal,

This is a semi-automatic email about new static checker warnings.

The patch 0ff393463e9c: "mtd: rawnand: allocate dynamically ONFI 
parameters during detection" from Jul 25, 2018, leads to the 
following Smatch complaint:

    drivers/mtd/nand/raw/nand_micron.c:93 micron_nand_onfi_init()
     warn: variable dereferenced before check 'p->onfi' (see line 91)

drivers/mtd/nand/raw/nand_micron.c
    90		struct nand_parameters *p = &chip->parameters;
    91		struct nand_onfi_vendor_micron *micron = (void *)p->onfi->vendor;
                                                                 ^^^^^^^^^^^^^^^
The code dereferences "p->onfi"

    92	
    93		if (p->onfi) {
                    ^^^^^^^
but the patch adds a new check for NULL.

    94			chip->read_retries = micron->read_retry_options;
    95			chip->setup_read_retry = micron_nand_setup_read_retry;

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] mtd: rawnand: allocate dynamically ONFI parameters during detection
  2018-07-31 18:26 [bug report] mtd: rawnand: allocate dynamically ONFI parameters during detection Dan Carpenter
@ 2018-08-01  6:56 ` Miquel Raynal
  0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2018-08-01  6:56 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-mtd

Hi Dan,

Dan Carpenter <dan.carpenter@oracle.com> wrote on Tue, 31 Jul 2018
21:26:54 +0300:

> Hello Miquel Raynal,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 0ff393463e9c: "mtd: rawnand: allocate dynamically ONFI 
> parameters during detection" from Jul 25, 2018, leads to the 
> following Smatch complaint:
> 
>     drivers/mtd/nand/raw/nand_micron.c:93 micron_nand_onfi_init()
>      warn: variable dereferenced before check 'p->onfi' (see line 91)
> 
> drivers/mtd/nand/raw/nand_micron.c
>     90		struct nand_parameters *p = &chip->parameters;
>     91		struct nand_onfi_vendor_micron *micron = (void *)p->onfi->vendor;
>                                                                  ^^^^^^^^^^^^^^^
> The code dereferences "p->onfi"
> 
>     92	
>     93		if (p->onfi) {

That's right, I'll dereference p->onfi only in this block as it's not
used elsewhere.

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-01  6:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31 18:26 [bug report] mtd: rawnand: allocate dynamically ONFI parameters during detection Dan Carpenter
2018-08-01  6:56 ` Miquel Raynal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.