lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 10 Nov 2023 02:04:18 +0800
From:   kernel test robot <lkp@...el.com>
To:     Hannes Reinecke <hare@...e.de>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Keith Busch <kbusch@...nel.org>
Subject: drivers/nvme/target/tcp.c:1773:27: sparse: sparse: cast to
 restricted __le32

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@...el.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ