From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [hare-scsi-devel:auth.v5 11/12] drivers/nvme/target/fabrics-cmd-auth.c:346:30: sparse: sparse: incorrect type in assignment (different base types)
Date: Fri, 26 Nov 2021 15:45:48 +0800 [thread overview]
Message-ID: <202111261548.YAoOcBe0-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4096 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git auth.v5
head: 1d58df043579d325e3c2a5926a89282183393f49
commit: 6ca636fe7f5c7c1d040fb4328ef7b47a62165a7e [11/12] nvmet-auth: Diffie-Hellman key exchange support
config: nios2-randconfig-s031-20211115 (https://download.01.org/0day-ci/archive/20211126/202111261548.YAoOcBe0-lkp(a)intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.2.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-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=6ca636fe7f5c7c1d040fb4328ef7b47a62165a7e
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.v5
git checkout 6ca636fe7f5c7c1d040fb4328ef7b47a62165a7e
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
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:84:22: sparse: sparse: cast to restricted __le32
drivers/nvme/target/fabrics-cmd-auth.c:84:22: sparse: sparse: cast from restricted __le16
>> drivers/nvme/target/fabrics-cmd-auth.c:346: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:346:30: sparse: expected restricted __le16 [usertype] dhvlen
drivers/nvme/target/fabrics-cmd-auth.c:346:30: sparse: got restricted __le32 [usertype]
vim +346 drivers/nvme/target/fabrics-cmd-auth.c
315
316 static int nvmet_auth_challenge(struct nvmet_req *req, void *d, int al)
317 {
318 struct nvmf_auth_dhchap_challenge_data *data = d;
319 struct nvmet_ctrl *ctrl = req->sq->ctrl;
320 int ret = 0;
321 int hash_len = nvme_auth_hmac_hash_len(ctrl->shash_id);
322 int data_size = sizeof(*d) + hash_len;
323
324 if (ctrl->dh_tfm)
325 data_size += ctrl->dh_keysize;
326 if (al < data_size) {
327 pr_debug("%s: buffer too small (al %d need %d)\n", __func__,
328 al, data_size);
329 return -EINVAL;
330 }
331 memset(data, 0, data_size);
332 req->sq->dhchap_s1 = ctrl->dhchap_seqnum++;
333 data->auth_type = NVME_AUTH_DHCHAP_MESSAGES;
334 data->auth_id = NVME_AUTH_DHCHAP_MESSAGE_CHALLENGE;
335 data->t_id = cpu_to_le16(req->sq->dhchap_tid);
336 data->hashid = ctrl->shash_id;
337 data->hl = hash_len;
338 data->seqnum = cpu_to_le32(req->sq->dhchap_s1);
339 req->sq->dhchap_c1 = kmalloc(data->hl, GFP_KERNEL);
340 if (!req->sq->dhchap_c1)
341 return -ENOMEM;
342 get_random_bytes(req->sq->dhchap_c1, data->hl);
343 memcpy(data->cval, req->sq->dhchap_c1, data->hl);
344 if (ctrl->dh_tfm) {
345 data->dhgid = ctrl->dh_gid;
> 346 data->dhvlen = cpu_to_le32(ctrl->dh_keysize);
347 ret = nvmet_auth_ctrl_exponential(req, data->cval + data->hl,
348 ctrl->dh_keysize);
349 }
350 pr_debug("%s: ctrl %d qid %d seq %d transaction %d hl %d dhvlen %d\n",
351 __func__, ctrl->cntlid, req->sq->qid, req->sq->dhchap_s1,
352 req->sq->dhchap_tid, data->hl, ctrl->dh_keysize);
353 return ret;
354 }
355
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Hannes Reinecke <hare@suse.de>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: [hare-scsi-devel:auth.v5 11/12] drivers/nvme/target/fabrics-cmd-auth.c:346:30: sparse: sparse: incorrect type in assignment (different base types)
Date: Fri, 26 Nov 2021 15:45:48 +0800 [thread overview]
Message-ID: <202111261548.YAoOcBe0-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git auth.v5
head: 1d58df043579d325e3c2a5926a89282183393f49
commit: 6ca636fe7f5c7c1d040fb4328ef7b47a62165a7e [11/12] nvmet-auth: Diffie-Hellman key exchange support
config: nios2-randconfig-s031-20211115 (https://download.01.org/0day-ci/archive/20211126/202111261548.YAoOcBe0-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.2.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-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=6ca636fe7f5c7c1d040fb4328ef7b47a62165a7e
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.v5
git checkout 6ca636fe7f5c7c1d040fb4328ef7b47a62165a7e
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
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:84:22: sparse: sparse: cast to restricted __le32
drivers/nvme/target/fabrics-cmd-auth.c:84:22: sparse: sparse: cast from restricted __le16
>> drivers/nvme/target/fabrics-cmd-auth.c:346: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:346:30: sparse: expected restricted __le16 [usertype] dhvlen
drivers/nvme/target/fabrics-cmd-auth.c:346:30: sparse: got restricted __le32 [usertype]
vim +346 drivers/nvme/target/fabrics-cmd-auth.c
315
316 static int nvmet_auth_challenge(struct nvmet_req *req, void *d, int al)
317 {
318 struct nvmf_auth_dhchap_challenge_data *data = d;
319 struct nvmet_ctrl *ctrl = req->sq->ctrl;
320 int ret = 0;
321 int hash_len = nvme_auth_hmac_hash_len(ctrl->shash_id);
322 int data_size = sizeof(*d) + hash_len;
323
324 if (ctrl->dh_tfm)
325 data_size += ctrl->dh_keysize;
326 if (al < data_size) {
327 pr_debug("%s: buffer too small (al %d need %d)\n", __func__,
328 al, data_size);
329 return -EINVAL;
330 }
331 memset(data, 0, data_size);
332 req->sq->dhchap_s1 = ctrl->dhchap_seqnum++;
333 data->auth_type = NVME_AUTH_DHCHAP_MESSAGES;
334 data->auth_id = NVME_AUTH_DHCHAP_MESSAGE_CHALLENGE;
335 data->t_id = cpu_to_le16(req->sq->dhchap_tid);
336 data->hashid = ctrl->shash_id;
337 data->hl = hash_len;
338 data->seqnum = cpu_to_le32(req->sq->dhchap_s1);
339 req->sq->dhchap_c1 = kmalloc(data->hl, GFP_KERNEL);
340 if (!req->sq->dhchap_c1)
341 return -ENOMEM;
342 get_random_bytes(req->sq->dhchap_c1, data->hl);
343 memcpy(data->cval, req->sq->dhchap_c1, data->hl);
344 if (ctrl->dh_tfm) {
345 data->dhgid = ctrl->dh_gid;
> 346 data->dhvlen = cpu_to_le32(ctrl->dh_keysize);
347 ret = nvmet_auth_ctrl_exponential(req, data->cval + data->hl,
348 ctrl->dh_keysize);
349 }
350 pr_debug("%s: ctrl %d qid %d seq %d transaction %d hl %d dhvlen %d\n",
351 __func__, ctrl->cntlid, req->sq->qid, req->sq->dhchap_s1,
352 req->sq->dhchap_tid, data->hl, ctrl->dh_keysize);
353 return ret;
354 }
355
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
next reply other threads:[~2021-11-26 7:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-26 7:45 kernel test robot [this message]
2021-11-26 7:45 ` [hare-scsi-devel:auth.v5 11/12] drivers/nvme/target/fabrics-cmd-auth.c:346:30: sparse: sparse: incorrect type in assignment (different base types) kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202111261548.YAoOcBe0-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.