linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org,
	Sai Krishna Potthuri <lakshmi.sai.krishna.potthuri@xilinx.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-arm-kernel@lists.infradead.org,
	Michal Simek <monstr@monstr.eu>
Subject: [xlnx:xlnx_rebase_v5.10 1377/1762] drivers/mtd/spi-nor/core.c:2246 spi_nor_read_id() error: we previously assumed 'nor->spimem' could be null (see line 2228)
Date: Tue, 31 Aug 2021 11:53:11 +0300	[thread overview]
Message-ID: <202108311024.yIMfmnhL-lkp@intel.com> (raw)

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.10
head:   09a4215f61493584f4410cab3477003e4046dab9
commit: d50528bd5db19df218fd9bd1e226a5644b769007 [1377/1762] spi: spi-cadence-quadspi: Added support for DDR PHY mode
config: arm-randconfig-m031-20210830 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/mtd/spi-nor/core.c:2246 spi_nor_read_id() error: we previously assumed 'nor->spimem' could be null (see line 2228)

Old smatch warnings:
drivers/mtd/spi-nor/core.c:1072 write_ear() error: uninitialized symbol 'code'.
drivers/mtd/spi-nor/core.c:1474 spi_nor_init_erase_cmd_list() warn: passing a valid pointer to 'PTR_ERR'
drivers/mtd/spi-nor/core.c:1487 spi_nor_init_erase_cmd_list() warn: passing a valid pointer to 'PTR_ERR'

vim +2246 drivers/mtd/spi-nor/core.c

06bb6f5a69dfc5 drivers/mtd/spi-nor/spi-nor.c Rafał Miłecki        2015-08-10  2221  static const struct flash_info *spi_nor_read_id(struct spi_nor *nor)
b199489d37b21c drivers/mtd/spi-nor/spi-nor.c Huang Shijie         2014-02-24  2222  {
9ec4bbcb2044ea drivers/mtd/spi-nor/core.c    Boris Brezillon      2020-03-13  2223  	const struct flash_info *info;
f173f26a4d543f drivers/mtd/spi-nor/spi-nor.c Vignesh Raghavendra  2019-08-06  2224  	u8 *id = nor->bouncebuf;
2dcbfe365b1303 drivers/mtd/spi-nor/spi-nor.c Jonathan Neuschäfer  2020-02-23  2225  	unsigned int i;
2dcbfe365b1303 drivers/mtd/spi-nor/spi-nor.c Jonathan Neuschäfer  2020-02-23  2226  	int ret;
b199489d37b21c drivers/mtd/spi-nor/spi-nor.c Huang Shijie         2014-02-24  2227  
b35b9a10362d20 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon      2019-08-06 @2228  	if (nor->spimem) {
                                                                                            ^^^^^^^^^^^
Check for NULL

b35b9a10362d20 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon      2019-08-06  2229  		struct spi_mem_op op =
b35b9a10362d20 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon      2019-08-06  2230  			SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_RDID, 1),
b35b9a10362d20 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon      2019-08-06  2231  				   SPI_MEM_OP_NO_ADDR,
b35b9a10362d20 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon      2019-08-06  2232  				   SPI_MEM_OP_NO_DUMMY,
b35b9a10362d20 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon      2019-08-06  2233  				   SPI_MEM_OP_DATA_IN(SPI_NOR_MAX_ID_LEN, id, 1));
b35b9a10362d20 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon      2019-08-06  2234  
2dcbfe365b1303 drivers/mtd/spi-nor/spi-nor.c Jonathan Neuschäfer  2020-02-23  2235  		ret = spi_mem_exec_op(nor->spimem, &op);
b35b9a10362d20 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon      2019-08-06  2236  	} else {
2dcbfe365b1303 drivers/mtd/spi-nor/spi-nor.c Jonathan Neuschäfer  2020-02-23  2237  		ret = nor->controller_ops->read_reg(nor, SPINOR_OP_RDID, id,
b35b9a10362d20 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon      2019-08-06  2238  						    SPI_NOR_MAX_ID_LEN);
b35b9a10362d20 drivers/mtd/spi-nor/spi-nor.c Boris Brezillon      2019-08-06  2239  	}
2dcbfe365b1303 drivers/mtd/spi-nor/spi-nor.c Jonathan Neuschäfer  2020-02-23  2240  	if (ret) {
2dcbfe365b1303 drivers/mtd/spi-nor/spi-nor.c Jonathan Neuschäfer  2020-02-23  2241  		dev_dbg(nor->dev, "error %d reading JEDEC ID\n", ret);
2dcbfe365b1303 drivers/mtd/spi-nor/spi-nor.c Jonathan Neuschäfer  2020-02-23  2242  		return ERR_PTR(ret);
b199489d37b21c drivers/mtd/spi-nor/spi-nor.c Huang Shijie         2014-02-24  2243  	}
b199489d37b21c drivers/mtd/spi-nor/spi-nor.c Huang Shijie         2014-02-24  2244  
d50528bd5db19d drivers/mtd/spi-nor/core.c    Sai Krishna Potthuri 2021-02-02  2245  	for (i = 0; i < SPI_NOR_MAX_ID_LEN; i++)
d50528bd5db19d drivers/mtd/spi-nor/core.c    Sai Krishna Potthuri 2021-02-02 @2246  		nor->spimem->device_id[i] = id[i];
                                                                                                ^^^^^^^^^^^
Unchecked dereference.

d50528bd5db19d drivers/mtd/spi-nor/core.c    Sai Krishna Potthuri 2021-02-02  2247  
9ec4bbcb2044ea drivers/mtd/spi-nor/core.c    Boris Brezillon      2020-03-13  2248  	for (i = 0; i < ARRAY_SIZE(manufacturers); i++) {
9ec4bbcb2044ea drivers/mtd/spi-nor/core.c    Boris Brezillon      2020-03-13  2249  		info = spi_nor_search_part_by_id(manufacturers[i]->parts,
9ec4bbcb2044ea drivers/mtd/spi-nor/core.c    Boris Brezillon      2020-03-13  2250  						 manufacturers[i]->nparts,
9ec4bbcb2044ea drivers/mtd/spi-nor/core.c    Boris Brezillon      2020-03-13  2251  						 id);
9ec4bbcb2044ea drivers/mtd/spi-nor/core.c    Boris Brezillon      2020-03-13  2252  		if (info) {
9ec4bbcb2044ea drivers/mtd/spi-nor/core.c    Boris Brezillon      2020-03-13  2253  			nor->manufacturer = manufacturers[i];
9ec4bbcb2044ea drivers/mtd/spi-nor/core.c    Boris Brezillon      2020-03-13  2254  			return info;
b199489d37b21c drivers/mtd/spi-nor/spi-nor.c Huang Shijie         2014-02-24  2255  		}
9ec4bbcb2044ea drivers/mtd/spi-nor/core.c    Boris Brezillon      2020-03-13  2256  	}
9ec4bbcb2044ea drivers/mtd/spi-nor/core.c    Boris Brezillon      2020-03-13  2257  
3ddc8adbbc7683 drivers/mtd/spi-nor/spi-nor.c Geert Uytterhoeven   2019-03-12  2258  	dev_err(nor->dev, "unrecognized JEDEC id bytes: %*ph\n",
3ddc8adbbc7683 drivers/mtd/spi-nor/spi-nor.c Geert Uytterhoeven   2019-03-12  2259  		SPI_NOR_MAX_ID_LEN, id);
b199489d37b21c drivers/mtd/spi-nor/spi-nor.c Huang Shijie         2014-02-24  2260  	return ERR_PTR(-ENODEV);
b199489d37b21c drivers/mtd/spi-nor/spi-nor.c Huang Shijie         2014-02-24  2261  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

                 reply	other threads:[~2021-08-31  8:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202108311024.yIMfmnhL-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=lakshmi.sai.krishna.potthuri@xilinx.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lkp@intel.com \
    --cc=monstr@monstr.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).