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]
Message-ID: <202202262102.YfMrKOTP-lkp@intel.com>
Date:   Sun, 27 Feb 2022 03:13:53 +0800
From:   kernel test robot <lkp@...el.com>
To:     Hannes Reinecke <hare@...e.de>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [hare-scsi-devel:tls-upcall.v2 149/159]
 drivers/nvme/host/tcp.c:1299:35: warning: format specifies type 'unsigned
 long' but the argument has type 'size_t' (aka 'unsigned int')

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git tls-upcall.v2
head:   21b520ae0b338bd30496feb1ca90a2820dab7a65
commit: 96e2b9364c5e070dab1a5d438376a406ab66690d [149/159] nvme-tcp: cmsg for tls recvmsg()
config: hexagon-randconfig-r023-20220226 (https://download.01.org/0day-ci/archive/20220226/202202262102.YfMrKOTP-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=96e2b9364c5e070dab1a5d438376a406ab66690d
        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 tls-upcall.v2
        git checkout 96e2b9364c5e070dab1a5d438376a406ab66690d
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/nvme/host/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> drivers/nvme/host/tcp.c:1299:35: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                    nvme_tcp_queue_id(queue), ret, iov.iov_len);
                                                   ^~~~~~~~~~~
   include/linux/printk.h:574:26: note: expanded from macro 'pr_debug'
           dynamic_pr_debug(fmt, ##__VA_ARGS__)
                            ~~~    ^~~~~~~~~~~
   include/linux/dynamic_debug.h:163:22: note: expanded from macro 'dynamic_pr_debug'
                              pr_fmt(fmt), ##__VA_ARGS__)
                                     ~~~     ^~~~~~~~~~~
   include/linux/dynamic_debug.h:152:56: note: expanded from macro '_dynamic_func_call'
           __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
                                                                 ^~~~~~~~~~~
   include/linux/dynamic_debug.h:134:15: note: expanded from macro '__dynamic_func_call'
                   func(&id, ##__VA_ARGS__);               \
                               ^~~~~~~~~~~
   drivers/nvme/host/tcp.c:1328:35: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                    nvme_tcp_queue_id(queue), ret, iov.iov_len);
                                                   ^~~~~~~~~~~
   include/linux/printk.h:574:26: note: expanded from macro 'pr_debug'
           dynamic_pr_debug(fmt, ##__VA_ARGS__)
                            ~~~    ^~~~~~~~~~~
   include/linux/dynamic_debug.h:163:22: note: expanded from macro 'dynamic_pr_debug'
                              pr_fmt(fmt), ##__VA_ARGS__)
                                     ~~~     ^~~~~~~~~~~
   include/linux/dynamic_debug.h:152:56: note: expanded from macro '_dynamic_func_call'
           __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
                                                                 ^~~~~~~~~~~
   include/linux/dynamic_debug.h:134:15: note: expanded from macro '__dynamic_func_call'
                   func(&id, ##__VA_ARGS__);               \
                               ^~~~~~~~~~~
   2 warnings generated.


vim +1299 drivers/nvme/host/tcp.c

  1255	
  1256	static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue)
  1257	{
  1258		struct nvme_tcp_icreq_pdu *icreq;
  1259		struct nvme_tcp_icresp_pdu *icresp;
  1260		struct msghdr msg = {};
  1261		char cbuf[CMSG_SPACE(sizeof(char))];
  1262		struct cmsghdr *cmsg;
  1263		unsigned char ctype;
  1264		struct kvec iov;
  1265		bool ctrl_hdgst, ctrl_ddgst;
  1266		int ret;
  1267	
  1268		icreq = kzalloc(sizeof(*icreq), GFP_KERNEL);
  1269		if (!icreq)
  1270			return -ENOMEM;
  1271	
  1272		icresp = kzalloc(sizeof(*icresp), GFP_KERNEL);
  1273		if (!icresp) {
  1274			ret = -ENOMEM;
  1275			goto free_icreq;
  1276		}
  1277	
  1278		icreq->hdr.type = nvme_tcp_icreq;
  1279		icreq->hdr.hlen = sizeof(*icreq);
  1280		icreq->hdr.pdo = 0;
  1281		icreq->hdr.plen = cpu_to_le32(icreq->hdr.hlen);
  1282		icreq->pfv = cpu_to_le16(NVME_TCP_PFV_1_0);
  1283		icreq->maxr2t = 0; /* single inflight r2t supported */
  1284		icreq->hpda = 0; /* no alignment constraint */
  1285		if (queue->hdr_digest)
  1286			icreq->digest |= NVME_TCP_HDR_DIGEST_ENABLE;
  1287		if (queue->data_digest)
  1288			icreq->digest |= NVME_TCP_DATA_DIGEST_ENABLE;
  1289	
  1290		iov.iov_base = icreq;
  1291		iov.iov_len = sizeof(*icreq);
  1292		ret = kernel_sendmsg(queue->sock, &msg, &iov, 1, iov.iov_len);
  1293		if (ret < 0) {
  1294			pr_err("queue %d: failed to send icresp, error %d\n",
  1295			       nvme_tcp_queue_id(queue), ret);
  1296			goto free_icresp;
  1297		}
  1298		pr_debug("queue %d: sent %d/%lu icreq bytes\n",
> 1299			 nvme_tcp_queue_id(queue), ret, iov.iov_len);
  1300		memset(&msg, 0, sizeof(msg));
  1301		msg.msg_control = cbuf;
  1302		msg.msg_controllen = sizeof(cbuf);
  1303		msg.msg_flags = MSG_WAITALL;
  1304		iov.iov_base = icresp;
  1305		iov.iov_len = sizeof(*icresp);
  1306		ret = kernel_recvmsg(queue->sock, &msg, &iov, 1,
  1307				iov.iov_len, msg.msg_flags);
  1308		cmsg = CMSG_FIRSTHDR(&msg);
  1309		if (cmsg) {
  1310			pr_debug("queue %d: received cmsg level %d\n",
  1311				 nvme_tcp_queue_id(queue), cmsg->cmsg_level);
  1312			if (cmsg->cmsg_level == SOL_TLS) {
  1313				pr_debug("queue %d: received tls cmsg %d\n",
  1314					 nvme_tcp_queue_id(queue), cmsg->cmsg_type);
  1315				if (cmsg->cmsg_type == TLS_GET_RECORD_TYPE) {
  1316					ctype = *((unsigned char *)CMSG_DATA(cmsg));
  1317					if (ctype != 100)
  1318						ret = -ENOTCONN;
  1319				}
  1320			}
  1321		}
  1322		if (ret < 0) {
  1323			pr_err("queue %d: failed to receive icresp, error %d\n",
  1324			       nvme_tcp_queue_id(queue), ret);
  1325			goto free_icresp;
  1326		}
  1327		pr_debug("queue %d: received %d/%lu icresp bytes\n",
  1328			 nvme_tcp_queue_id(queue), ret, iov.iov_len);
  1329		ret = -EINVAL;
  1330		if (icresp->hdr.type != nvme_tcp_icresp) {
  1331			pr_err("queue %d: bad type returned %d\n",
  1332				nvme_tcp_queue_id(queue), icresp->hdr.type);
  1333			print_hex_dump(KERN_ERR, "icresp: ", 0,
  1334				       8, 1, icresp, iov.iov_len, true);
  1335			goto free_icresp;
  1336		}
  1337	
  1338		if (le32_to_cpu(icresp->hdr.plen) != sizeof(*icresp)) {
  1339			pr_err("queue %d: bad pdu length returned %d\n",
  1340				nvme_tcp_queue_id(queue), icresp->hdr.plen);
  1341			goto free_icresp;
  1342		}
  1343	
  1344		if (icresp->pfv != NVME_TCP_PFV_1_0) {
  1345			pr_err("queue %d: bad pfv returned %d\n",
  1346				nvme_tcp_queue_id(queue), icresp->pfv);
  1347			goto free_icresp;
  1348		}
  1349	
  1350		ctrl_ddgst = !!(icresp->digest & NVME_TCP_DATA_DIGEST_ENABLE);
  1351		if ((queue->data_digest && !ctrl_ddgst) ||
  1352		    (!queue->data_digest && ctrl_ddgst)) {
  1353			pr_err("queue %d: data digest mismatch host: %s ctrl: %s\n",
  1354				nvme_tcp_queue_id(queue),
  1355				queue->data_digest ? "enabled" : "disabled",
  1356				ctrl_ddgst ? "enabled" : "disabled");
  1357			goto free_icresp;
  1358		}
  1359	
  1360		ctrl_hdgst = !!(icresp->digest & NVME_TCP_HDR_DIGEST_ENABLE);
  1361		if ((queue->hdr_digest && !ctrl_hdgst) ||
  1362		    (!queue->hdr_digest && ctrl_hdgst)) {
  1363			pr_err("queue %d: header digest mismatch host: %s ctrl: %s\n",
  1364				nvme_tcp_queue_id(queue),
  1365				queue->hdr_digest ? "enabled" : "disabled",
  1366				ctrl_hdgst ? "enabled" : "disabled");
  1367			goto free_icresp;
  1368		}
  1369	
  1370		if (icresp->cpda != 0) {
  1371			pr_err("queue %d: unsupported cpda returned %d\n",
  1372				nvme_tcp_queue_id(queue), icresp->cpda);
  1373			goto free_icresp;
  1374		}
  1375	
  1376		ret = 0;
  1377	free_icresp:
  1378		kfree(icresp);
  1379	free_icreq:
  1380		kfree(icreq);
  1381		return ret;
  1382	}
  1383	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ