mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>
Subject: drivers/nvme/target/tcp.c:1325:46: sparse: sparse: incorrect type in assignment (different base types)
Date: Fri, 12 Jun 2026 22:15:23 +0800	[thread overview]
Message-ID: <202606122214.l63U4QS2-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2b414a95b8f7307d42173ba9e580d6d3e2bcbfce
commit: dbbd07d0a7020b80f6a7028e561908f7b83b3d5a nvmet-tcp: Fix potential UAF when ddgst mismatch
date:   5 weeks ago
config: sh-randconfig-r123-20260612 (https://download.01.org/0day-ci/archive/20260612/202606122214.l63U4QS2-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 16.1.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260612/202606122214.l63U4QS2-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
| Fixes: dbbd07d0a702 ("nvmet-tcp: Fix potential UAF when ddgst mismatch")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606122214.l63U4QS2-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/nvme/target/tcp.c:1325:46: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le16 [usertype] status @@     got int @@
   drivers/nvme/target/tcp.c:1325:46: sparse:     expected restricted __le16 [usertype] status
   drivers/nvme/target/tcp.c:1325:46: sparse:     got int

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

  1288	
  1289	static int nvmet_tcp_try_recv_ddgst(struct nvmet_tcp_queue *queue)
  1290	{
  1291		struct nvmet_tcp_cmd *cmd = queue->cmd;
  1292		int ret, len;
  1293		char cbuf[CMSG_LEN(sizeof(char))] = {};
  1294		struct msghdr msg = { .msg_flags = MSG_DONTWAIT };
  1295		struct kvec iov = {
  1296			.iov_base = (void *)&cmd->recv_ddgst + queue->offset,
  1297			.iov_len = queue->left
  1298		};
  1299	
  1300		if (queue->tls_pskid) {
  1301			msg.msg_control = cbuf;
  1302			msg.msg_controllen = sizeof(cbuf);
  1303		}
  1304		len = kernel_recvmsg(queue->sock, &msg, &iov, 1,
  1305				iov.iov_len, msg.msg_flags);
  1306		if (unlikely(len < 0))
  1307			return len;
  1308		if (queue->tls_pskid) {
  1309			ret = nvmet_tcp_tls_record_ok(queue, &msg, cbuf);
  1310			if (ret < 0)
  1311				return ret;
  1312		}
  1313	
  1314		queue->offset += len;
  1315		queue->left -= len;
  1316		if (queue->left)
  1317			return -EAGAIN;
  1318	
  1319		if (queue->data_digest && cmd->exp_ddgst != cmd->recv_ddgst) {
  1320			pr_err("queue %d: cmd %d pdu (%d) data digest error: recv %#x expected %#x\n",
  1321				queue->idx, cmd->req.cmd->common.command_id,
  1322				queue->pdu.cmd.hdr.type, le32_to_cpu(cmd->recv_ddgst),
  1323				le32_to_cpu(cmd->exp_ddgst));
  1324			if (!(cmd->flags & NVMET_TCP_F_INIT_FAILED)) {
> 1325				cmd->req.cqe->status = NVME_SC_CMD_SEQ_ERROR;
  1326				nvmet_req_uninit(&cmd->req);
  1327			}
  1328			nvmet_tcp_free_cmd_buffers(cmd);
  1329			ret = -EPROTO;
  1330			goto out;
  1331		}
  1332	
  1333		if (cmd->rbytes_done == cmd->req.transfer_len)
  1334			nvmet_tcp_execute_request(cmd);
  1335	
  1336		ret = 0;
  1337	out:
  1338		nvmet_prepare_receive_pdu(queue);
  1339		return ret;
  1340	}
  1341	

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

                 reply	other threads:[~2026-06-12 14:15 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=202606122214.l63U4QS2-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=sagi@grimberg.me \
    /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

all inboxes | Powered by JetHome®