[linux-nvme:nvme-5.9-rc 14/15] drivers/nvme/host/zns.c:170 nvme_ns_report_zones() error: uninitialized symbol 'buflen'.

Dan Carpenter dan.carpenter at oracle.com
Mon Aug 31 08:08:30 EDT 2020


tree:   git://git.infradead.org/nvme.git nvme-5.9-rc
head:   82e3e51f2fb2246eee837fa4aeee79ec1f921c89
commit: cd83b396e350d2f13bd2ad81565255f77a13aa3a [14/15] nvme: fix error handling in nvme_ns_report_zones
config: x86_64-randconfig-m001-20200828 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

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

smatch warnings:
drivers/nvme/host/zns.c:170 nvme_ns_report_zones() error: uninitialized symbol 'buflen'.

git remote add linux-nvme git://git.infradead.org/nvme.git
git fetch --no-tags linux-nvme nvme-5.9-rc
git checkout cd83b396e350d2f13bd2ad81565255f77a13aa3a
vim +/buflen +170 drivers/nvme/host/zns.c

240e6ee272c07a2 Keith Busch       2020-06-29  159  static int nvme_ns_report_zones(struct nvme_ns *ns, sector_t sector,
240e6ee272c07a2 Keith Busch       2020-06-29  160  			unsigned int nr_zones, report_zones_cb cb, void *data)
240e6ee272c07a2 Keith Busch       2020-06-29  161  {
240e6ee272c07a2 Keith Busch       2020-06-29  162  	struct nvme_zone_report *report;
cd83b396e350d2f Christoph Hellwig 2020-08-25  163  	struct nvme_command c = { };
240e6ee272c07a2 Keith Busch       2020-06-29  164  	int ret, zone_idx = 0;
240e6ee272c07a2 Keith Busch       2020-06-29  165  	unsigned int nz, i;
240e6ee272c07a2 Keith Busch       2020-06-29  166  	size_t buflen;
240e6ee272c07a2 Keith Busch       2020-06-29  167  
cd83b396e350d2f Christoph Hellwig 2020-08-25  168  	c.zmr.opcode = nvme_cmd_zone_mgmt_recv;
cd83b396e350d2f Christoph Hellwig 2020-08-25  169  	c.zmr.nsid = cpu_to_le32(ns->head->ns_id);
cd83b396e350d2f Christoph Hellwig 2020-08-25 @170  	c.zmr.numd = cpu_to_le32(nvme_bytes_to_numd(buflen));
                                                                                                    ^^^^^^
Uninitialized

cd83b396e350d2f Christoph Hellwig 2020-08-25  171  	c.zmr.zra = NVME_ZRA_ZONE_REPORT;
cd83b396e350d2f Christoph Hellwig 2020-08-25  172  	c.zmr.zrasf = NVME_ZRASF_ZONE_REPORT_ALL;
cd83b396e350d2f Christoph Hellwig 2020-08-25  173  	c.zmr.pr = NVME_REPORT_ZONE_PARTIAL;
cd83b396e350d2f Christoph Hellwig 2020-08-25  174  
240e6ee272c07a2 Keith Busch       2020-06-29  175  	report = nvme_zns_alloc_report_buffer(ns, nr_zones, &buflen);
                                                                                                            ^^^^^^^
until here

240e6ee272c07a2 Keith Busch       2020-06-29  176  	if (!report)
240e6ee272c07a2 Keith Busch       2020-06-29  177  		return -ENOMEM;
240e6ee272c07a2 Keith Busch       2020-06-29  178  
240e6ee272c07a2 Keith Busch       2020-06-29  179  	sector &= ~(ns->zsze - 1);
240e6ee272c07a2 Keith Busch       2020-06-29  180  	while (zone_idx < nr_zones && sector < get_capacity(ns->disk)) {
240e6ee272c07a2 Keith Busch       2020-06-29  181  		memset(report, 0, buflen);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 38801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20200831/ca121f84/attachment-0001.gz>


More information about the Linux-nvme mailing list