* [hare-scsi-devel:tls-netlink.v7 20/20] drivers/nvme/target/tcp.c:1155:16: sparse: sparse: restricted __le32 degrades to integer
@ 2023-03-23 18:54 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-03-23 18:54 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: oe-kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git tls-netlink.v7
head: 5c13b43fa2c503188a6d668b0dec6a22078329a2
commit: 5c13b43fa2c503188a6d668b0dec6a22078329a2 [20/20] nvmet-tcp: peek icreq before starting TLS
config: openrisc-randconfig-s042-20230319 (https://download.01.org/0day-ci/archive/20230324/202303240212.slier6vf-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 12.1.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-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=5c13b43fa2c503188a6d668b0dec6a22078329a2
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-netlink.v7
git checkout 5c13b43fa2c503188a6d668b0dec6a22078329a2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=openrisc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=openrisc SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303240212.slier6vf-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/nvme/target/tcp.c:1155:16: sparse: sparse: restricted __le32 degrades to integer
vim +1155 drivers/nvme/target/tcp.c
1107
1108 static int nvmet_tcp_try_peek_pdu(struct nvmet_tcp_queue *queue)
1109 {
1110 struct nvme_tcp_hdr *hdr = &queue->pdu.cmd.hdr;
1111 int len;
1112 struct kvec iov = {
1113 .iov_base = (u8 *)&queue->pdu + queue->offset,
1114 .iov_len = sizeof(struct nvme_tcp_hdr),
1115 };
1116 char cbuf[CMSG_LEN(sizeof(char))] = {};
1117 unsigned char ctype;
1118 struct cmsghdr *cmsg;
1119 struct msghdr msg = {
1120 .msg_control = cbuf,
1121 .msg_controllen = sizeof(cbuf),
1122 .msg_flags = MSG_PEEK,
1123 };
1124
1125 len = kernel_recvmsg(queue->sock, &msg, &iov, 1,
1126 iov.iov_len, msg.msg_flags);
1127 if (unlikely(len < 0)) {
1128 pr_debug("queue %d peek error %d\n",
1129 queue->idx, len);
1130 return len;
1131 }
1132
1133 cmsg = (struct cmsghdr *)cbuf;
1134 if (CMSG_OK(&msg, cmsg) &&
1135 cmsg->cmsg_level == SOL_TLS &&
1136 cmsg->cmsg_type == TLS_GET_RECORD_TYPE) {
1137 ctype = *((unsigned char *)CMSG_DATA(cmsg));
1138 if (ctype != TLS_RECORD_TYPE_DATA) {
1139 pr_err("queue %d unhandled TLS record %d\n",
1140 queue->idx, ctype);
1141 return -ENOTCONN;
1142 }
1143 }
1144
1145 if (len < sizeof(struct nvme_tcp_hdr)) {
1146 pr_debug("queue %d short read, %d bytes missing\n",
1147 queue->idx, (int)iov.iov_len - len);
1148 return -EAGAIN;
1149 }
1150 pr_debug("queue %d hdr type %d hlen %d plen %d size %d\n",
1151 queue->idx, hdr->type, hdr->hlen, hdr->plen,
1152 (int)sizeof(struct nvme_tcp_icreq_pdu));
1153 if (hdr->type == nvme_tcp_icreq &&
1154 hdr->hlen == sizeof(struct nvme_tcp_icreq_pdu) &&
> 1155 hdr->plen == sizeof(struct nvme_tcp_icreq_pdu)) {
1156 pr_debug("queue %d icreq detected\n",
1157 queue->idx);
1158 return len;
1159 }
1160 return 0;
1161 }
1162
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-23 18:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 18:54 [hare-scsi-devel:tls-netlink.v7 20/20] drivers/nvme/target/tcp.c:1155:16: sparse: sparse: restricted __le32 degrades to integer kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).