mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [hare-scsi-devel:auth.v13 8/9] drivers/nvme/target/fabrics-cmd-auth.c:364:30: sparse: sparse: incorrect type in assignment (different base types)
@ 2022-05-31  6:52 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-05-31  6:52 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: kbuild-all, linux-kernel, Sagi Grimberg

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git auth.v13
head:   a444c5289874c2a619b92858d240a7cf40c9874b
commit: 830cde52659a9c803beaa86a353ee8209a1f0767 [8/9] nvmet-auth: Diffie-Hellman key exchange support
config: arm-randconfig-s032-20220531 (https://download.01.org/0day-ci/archive/20220531/202205311440.ymt1kZQE-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-14-g5a0004b5-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=830cde52659a9c803beaa86a353ee8209a1f0767
        git remote add hare-scsi-devel https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
        git fetch --no-tags hare-scsi-devel auth.v13
        git checkout 830cde52659a9c803beaa86a353ee8209a1f0767
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash drivers/nvme/target/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   drivers/nvme/target/fabrics-cmd-auth.c:20:30: sparse: sparse: invalid assignment: |=
   drivers/nvme/target/fabrics-cmd-auth.c:20:30: sparse:    left side has type restricted __le32
   drivers/nvme/target/fabrics-cmd-auth.c:20:30: sparse:    right side has type int
   drivers/nvme/target/fabrics-cmd-auth.c:102:22: sparse: sparse: cast to restricted __le32
   drivers/nvme/target/fabrics-cmd-auth.c:102:22: sparse: sparse: cast from restricted __le16
>> drivers/nvme/target/fabrics-cmd-auth.c:364:30: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le16 [usertype] dhvlen @@     got restricted __le32 [usertype] @@
   drivers/nvme/target/fabrics-cmd-auth.c:364:30: sparse:     expected restricted __le16 [usertype] dhvlen
   drivers/nvme/target/fabrics-cmd-auth.c:364:30: sparse:     got restricted __le32 [usertype]

vim +364 drivers/nvme/target/fabrics-cmd-auth.c

   333	
   334	static int nvmet_auth_challenge(struct nvmet_req *req, void *d, int al)
   335	{
   336		struct nvmf_auth_dhchap_challenge_data *data = d;
   337		struct nvmet_ctrl *ctrl = req->sq->ctrl;
   338		int ret = 0;
   339		int hash_len = nvme_auth_hmac_hash_len(ctrl->shash_id);
   340		int data_size = sizeof(*d) + hash_len;
   341	
   342		if (ctrl->dh_tfm)
   343			data_size += ctrl->dh_keysize;
   344		if (al < data_size) {
   345			pr_debug("%s: buffer too small (al %d need %d)\n", __func__,
   346				 al, data_size);
   347			return -EINVAL;
   348		}
   349		memset(data, 0, data_size);
   350		req->sq->dhchap_s1 = nvme_auth_get_seqnum();
   351		data->auth_type = NVME_AUTH_DHCHAP_MESSAGES;
   352		data->auth_id = NVME_AUTH_DHCHAP_MESSAGE_CHALLENGE;
   353		data->t_id = cpu_to_le16(req->sq->dhchap_tid);
   354		data->hashid = ctrl->shash_id;
   355		data->hl = hash_len;
   356		data->seqnum = cpu_to_le32(req->sq->dhchap_s1);
   357		req->sq->dhchap_c1 = kmalloc(data->hl, GFP_KERNEL);
   358		if (!req->sq->dhchap_c1)
   359			return -ENOMEM;
   360		get_random_bytes(req->sq->dhchap_c1, data->hl);
   361		memcpy(data->cval, req->sq->dhchap_c1, data->hl);
   362		if (ctrl->dh_tfm) {
   363			data->dhgid = ctrl->dh_gid;
 > 364			data->dhvlen = cpu_to_le32(ctrl->dh_keysize);
   365			ret = nvmet_auth_ctrl_exponential(req, data->cval + data->hl,
   366							  ctrl->dh_keysize);
   367		}
   368		pr_debug("%s: ctrl %d qid %d seq %d transaction %d hl %d dhvlen %zu\n",
   369			 __func__, ctrl->cntlid, req->sq->qid, req->sq->dhchap_s1,
   370			 req->sq->dhchap_tid, data->hl, ctrl->dh_keysize);
   371		return ret;
   372	}
   373	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-31  6:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31  6:52 [hare-scsi-devel:auth.v13 8/9] drivers/nvme/target/fabrics-cmd-auth.c:364:30: sparse: sparse: incorrect type in assignment (different base types) kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®