[linux-nvme:nvme-5.12 7/9] drivers/nvme/host/core.c:4100 nvme_validate_or_alloc_ns() error: we previously assumed 'ns' could be null (see line 4082)

kernel test robot lkp at intel.com
Fri Mar 12 19:30:23 GMT 2021


tree:   git://git.infradead.org/nvme.git nvme-5.12
head:   abbb5f5929ec6c52574c430c5475c158a65c2a8c
commit: 0ec84df4953bd42c6583a555773f1d4996a061eb [7/9] nvme-core: check ctrl css before setting up zns
config: i386-randconfig-m021-20210312 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

New smatch warnings:
drivers/nvme/host/core.c:4100 nvme_validate_or_alloc_ns() error: we previously assumed 'ns' could be null (see line 4082)

Old smatch warnings:
drivers/nvme/host/core.c:692 nvme_configure_directives() warn: missing error code 'ret'
drivers/nvme/host/core.c:788 nvme_setup_discard() warn: possible memory leak of 'range'

vim +/ns +4100 drivers/nvme/host/core.c

  4072	
  4073	static void nvme_validate_or_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
  4074	{
  4075		struct nvme_ns_ids ids = { };
  4076		struct nvme_ns *ns;
  4077	
  4078		if (nvme_identify_ns_descs(ctrl, nsid, &ids))
  4079			return;
  4080	
  4081		ns = nvme_find_get_ns(ctrl, nsid);
> 4082		if (ns) {
  4083			nvme_validate_ns(ns, &ids);
  4084			nvme_put_ns(ns);
  4085			return;
  4086		}
  4087	
  4088		switch (ids.csi) {
  4089		case NVME_CSI_NVM:
  4090			nvme_alloc_ns(ctrl, nsid, &ids);
  4091			break;
  4092		case NVME_CSI_ZNS:
  4093			if (!IS_ENABLED(CONFIG_BLK_DEV_ZONED)) {
  4094				dev_warn(ctrl->device,
  4095					"nsid %u not supported without CONFIG_BLK_DEV_ZONED\n",
  4096					nsid);
  4097				break;
  4098			}
  4099			if (!nvme_multi_css(ctrl)) {
> 4100				dev_warn(ctrl->device,
  4101					"command set not reported for nsid: %d\n",
  4102					ns->head->ns_id);
  4103				break;
  4104			}
  4105			nvme_alloc_ns(ctrl, nsid, &ids);
  4106			break;
  4107		default:
  4108			dev_warn(ctrl->device, "unknown csi %u for nsid %u\n",
  4109				ids.csi, nsid);
  4110			break;
  4111		}
  4112	}
  4113	

---
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: 33745 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20210313/4f6d37a6/attachment-0001.gz>


More information about the Linux-nvme mailing list