All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-nvme:nvme-5.8 30/33] drivers/nvme/target/admin-cmd.c:541:32: sparse: sparse: incorrect type in assignment (different base types)
@ 2020-05-20 22:11 kbuild test robot
  2020-05-21  8:25 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2020-05-20 22:11 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3898 bytes --]

tree:   git://git.infradead.org/nvme.git nvme-5.8
head:   553d88b29099fdbc11a0a909995003d15a31a458
commit: af915d6c11227cc06ab23d2ab5649de066ed3dcc [30/33] nvmet: add metadata/T10-PI support
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-193-gb8fad4bc-dirty
        git checkout af915d6c11227cc06ab23d2ab5649de066ed3dcc
        # save the attached .config to linux build tree
        make C=1 ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

>> drivers/nvme/target/admin-cmd.c:541:32: sparse: sparse: incorrect type in assignment (different base types) @@    expected restricted __le16 [usertype] ms @@    got pe] ms @@
>> drivers/nvme/target/admin-cmd.c:541:32: sparse:    expected restricted __le16 [usertype] ms
>> drivers/nvme/target/admin-cmd.c:541:32: sparse:    got int metadata_size

vim +541 drivers/nvme/target/admin-cmd.c

   472	
   473	static void nvmet_execute_identify_ns(struct nvmet_req *req)
   474	{
   475		struct nvmet_ctrl *ctrl = req->sq->ctrl;
   476		struct nvmet_ns *ns;
   477		struct nvme_id_ns *id;
   478		u16 status = 0;
   479	
   480		if (le32_to_cpu(req->cmd->identify.nsid) == NVME_NSID_ALL) {
   481			req->error_loc = offsetof(struct nvme_identify, nsid);
   482			status = NVME_SC_INVALID_NS | NVME_SC_DNR;
   483			goto out;
   484		}
   485	
   486		id = kzalloc(sizeof(*id), GFP_KERNEL);
   487		if (!id) {
   488			status = NVME_SC_INTERNAL;
   489			goto out;
   490		}
   491	
   492		/* return an all zeroed buffer if we can't find an active namespace */
   493		ns = nvmet_find_namespace(ctrl, req->cmd->identify.nsid);
   494		if (!ns)
   495			goto done;
   496	
   497		nvmet_ns_revalidate(ns);
   498	
   499		/*
   500		 * nuse = ncap = nsze isn't always true, but we have no way to find
   501		 * that out from the underlying device.
   502		 */
   503		id->ncap = id->nsze = cpu_to_le64(ns->size >> ns->blksize_shift);
   504		switch (req->port->ana_state[ns->anagrpid]) {
   505		case NVME_ANA_INACCESSIBLE:
   506		case NVME_ANA_PERSISTENT_LOSS:
   507			break;
   508		default:
   509			id->nuse = id->nsze;
   510			break;
   511	        }
   512	
   513		if (ns->bdev)
   514			nvmet_bdev_set_limits(ns->bdev, id);
   515	
   516		/*
   517		 * We just provide a single LBA format that matches what the
   518		 * underlying device reports.
   519		 */
   520		id->nlbaf = 0;
   521		id->flbas = 0;
   522	
   523		/*
   524		 * Our namespace might always be shared.  Not just with other
   525		 * controllers, but also with any other user of the block device.
   526		 */
   527		id->nmic = (1 << 0);
   528		id->anagrpid = cpu_to_le32(ns->anagrpid);
   529	
   530		memcpy(&id->nguid, &ns->nguid, sizeof(id->nguid));
   531	
   532		id->lbaf[0].ds = ns->blksize_shift;
   533	
   534		if (ctrl->pi_support && nvmet_ns_has_pi(ns)) {
   535			id->dpc = NVME_NS_DPC_PI_FIRST | NVME_NS_DPC_PI_LAST |
   536				  NVME_NS_DPC_PI_TYPE1 | NVME_NS_DPC_PI_TYPE2 |
   537				  NVME_NS_DPC_PI_TYPE3;
   538			id->mc = NVME_MC_EXTENDED_LBA;
   539			id->dps = ns->pi_type;
   540			id->flbas = NVME_NS_FLBAS_META_EXT;
 > 541			id->lbaf[0].ms = ns->metadata_size;
   542		}
   543	
   544		if (ns->readonly)
   545			id->nsattr |= (1 << 0);
   546		nvmet_put_namespace(ns);
   547	done:
   548		status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));
   549		kfree(id);
   550	out:
   551		nvmet_req_complete(req, status);
   552	}
   553	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 73476 bytes --]

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

* Re: [linux-nvme:nvme-5.8 30/33] drivers/nvme/target/admin-cmd.c:541:32: sparse: sparse: incorrect type in assignment (different base types)
  2020-05-20 22:11 [linux-nvme:nvme-5.8 30/33] drivers/nvme/target/admin-cmd.c:541:32: sparse: sparse: incorrect type in assignment (different base types) kbuild test robot
@ 2020-05-21  8:25 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2020-05-21  8:25 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 50 bytes --]

I've added in the obviously missing cpu_to_le16().

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

end of thread, other threads:[~2020-05-21  8:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-20 22:11 [linux-nvme:nvme-5.8 30/33] drivers/nvme/target/admin-cmd.c:541:32: sparse: sparse: incorrect type in assignment (different base types) kbuild test robot
2020-05-21  8:25 ` Christoph Hellwig

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.