CC: [email protected]
CC: [email protected]
TO: Christoph Hellwig <[email protected]>
CC: Sagi Grimberg <[email protected]>
CC: Keith Busch <[email protected]>
CC: Chaitanya Kulkarni <[email protected]>

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
:::::: branch date: 14 hours ago
:::::: commit date: 18 hours ago
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 <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

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  158  
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));
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);
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);
cd83b396e350d2f Christoph Hellwig 2020-08-25  182  
cd83b396e350d2f Christoph Hellwig 2020-08-25  183               c.zmr.slba = 
cpu_to_le64(nvme_sect_to_lba(ns, sector));
cd83b396e350d2f Christoph Hellwig 2020-08-25  184               ret = 
nvme_submit_sync_cmd(ns->queue, &c, report, buflen);
cd83b396e350d2f Christoph Hellwig 2020-08-25  185               if (ret)
240e6ee272c07a2 Keith Busch       2020-06-29  186                       goto 
out_free;
240e6ee272c07a2 Keith Busch       2020-06-29  187  
cd83b396e350d2f Christoph Hellwig 2020-08-25  188               nz = 
min((unsigned int)le64_to_cpu(report->nr_zones), nr_zones);
240e6ee272c07a2 Keith Busch       2020-06-29  189               if (!nz)
240e6ee272c07a2 Keith Busch       2020-06-29  190                       break;
240e6ee272c07a2 Keith Busch       2020-06-29  191  
240e6ee272c07a2 Keith Busch       2020-06-29  192               for (i = 0; i < 
nz && zone_idx < nr_zones; i++) {
240e6ee272c07a2 Keith Busch       2020-06-29  193                       ret = 
nvme_zone_parse_entry(ns, &report->entries[i],
240e6ee272c07a2 Keith Busch       2020-06-29  194                               
                    zone_idx, cb, data);
240e6ee272c07a2 Keith Busch       2020-06-29  195                       if (ret)
240e6ee272c07a2 Keith Busch       2020-06-29  196                               
goto out_free;
240e6ee272c07a2 Keith Busch       2020-06-29  197                       
zone_idx++;
240e6ee272c07a2 Keith Busch       2020-06-29  198               }
240e6ee272c07a2 Keith Busch       2020-06-29  199  
240e6ee272c07a2 Keith Busch       2020-06-29  200               sector += 
ns->zsze * nz;
240e6ee272c07a2 Keith Busch       2020-06-29  201       }
240e6ee272c07a2 Keith Busch       2020-06-29  202  
240e6ee272c07a2 Keith Busch       2020-06-29  203       if (zone_idx > 0)
240e6ee272c07a2 Keith Busch       2020-06-29  204               ret = zone_idx;
240e6ee272c07a2 Keith Busch       2020-06-29  205       else
240e6ee272c07a2 Keith Busch       2020-06-29  206               ret = -EINVAL;
240e6ee272c07a2 Keith Busch       2020-06-29  207  out_free:
240e6ee272c07a2 Keith Busch       2020-06-29  208       kvfree(report);
240e6ee272c07a2 Keith Busch       2020-06-29  209       return ret;
240e6ee272c07a2 Keith Busch       2020-06-29  210  }
240e6ee272c07a2 Keith Busch       2020-06-29  211  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to