public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Hannes Reinecke <hare@suse.de>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Keith Busch <kbusch@kernel.org>
Subject: drivers/nvme/target/tcp.c:1773:27: sparse: sparse: cast to restricted __le32
Date: Fri, 10 Nov 2023 02:04:18 +0800	[thread overview]
Message-ID: <202311100256.Y1eZwPhd-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6bc986ab839c844e78a2333a02e55f02c9e57935
commit: 70525e5d82f62407d8436aa2a6c3385829ab5a3e nvmet-tcp: peek icreq before starting TLS
date:   4 weeks ago
config: loongarch-randconfig-r112-20231109 (https://download.01.org/0day-ci/archive/20231110/202311100256.Y1eZwPhd-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231110/202311100256.Y1eZwPhd-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311100256.Y1eZwPhd-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/nvme/target/tcp.c:1773:27: sparse: sparse: cast to restricted __le32

vim +1773 drivers/nvme/target/tcp.c

  1731	
  1732	#ifdef CONFIG_NVME_TARGET_TCP_TLS
  1733	static int nvmet_tcp_try_peek_pdu(struct nvmet_tcp_queue *queue)
  1734	{
  1735		struct nvme_tcp_hdr *hdr = &queue->pdu.cmd.hdr;
  1736		int len, ret;
  1737		struct kvec iov = {
  1738			.iov_base = (u8 *)&queue->pdu + queue->offset,
  1739			.iov_len = sizeof(struct nvme_tcp_hdr),
  1740		};
  1741		char cbuf[CMSG_LEN(sizeof(char))] = {};
  1742		struct msghdr msg = {
  1743			.msg_control = cbuf,
  1744			.msg_controllen = sizeof(cbuf),
  1745			.msg_flags = MSG_PEEK,
  1746		};
  1747	
  1748		if (nvmet_port_secure_channel_required(queue->port->nport))
  1749			return 0;
  1750	
  1751		len = kernel_recvmsg(queue->sock, &msg, &iov, 1,
  1752				iov.iov_len, msg.msg_flags);
  1753		if (unlikely(len < 0)) {
  1754			pr_debug("queue %d: peek error %d\n",
  1755				 queue->idx, len);
  1756			return len;
  1757		}
  1758	
  1759		ret = nvmet_tcp_tls_record_ok(queue, &msg, cbuf);
  1760		if (ret < 0)
  1761			return ret;
  1762	
  1763		if (len < sizeof(struct nvme_tcp_hdr)) {
  1764			pr_debug("queue %d: short read, %d bytes missing\n",
  1765				 queue->idx, (int)iov.iov_len - len);
  1766			return -EAGAIN;
  1767		}
  1768		pr_debug("queue %d: hdr type %d hlen %d plen %d size %d\n",
  1769			 queue->idx, hdr->type, hdr->hlen, hdr->plen,
  1770			 (int)sizeof(struct nvme_tcp_icreq_pdu));
  1771		if (hdr->type == nvme_tcp_icreq &&
  1772		    hdr->hlen == sizeof(struct nvme_tcp_icreq_pdu) &&
> 1773		    hdr->plen == (__le32)sizeof(struct nvme_tcp_icreq_pdu)) {
  1774			pr_debug("queue %d: icreq detected\n",
  1775				 queue->idx);
  1776			return len;
  1777		}
  1778		return 0;
  1779	}
  1780	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2023-11-09 18:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202311100256.Y1eZwPhd-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=hare@suse.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox