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:   Tue, 26 Jul 2022 18:58:24 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Pavel Begunkov <asml.silence@...il.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [isilence:zc_perf_tests 10/10] io_uring/net.c:1113 io_sendzc1()
 warn: ignoring unreachable code.

tree:   https://github.com/isilence/linux zc_perf_tests
head:   0909a53e1c81ca9432cbb58d15b87e500595bcbd
commit: 0909a53e1c81ca9432cbb58d15b87e500595bcbd [10/10] io_uring: simple zc
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220726/202207261540.tELcS8V6-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
io_uring/net.c:1113 io_sendzc1() warn: ignoring unreachable code.

vim +1113 io_uring/net.c

0909a53e1c81ca Pavel Begunkov 2022-07-24  1087  int io_sendzc1(struct io_kiocb *req, unsigned int issue_flags)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1088  {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1089  	struct io_sendzc1 *zc = io_kiocb_to_cmd(req);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1090  	struct msghdr msg;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1091  	struct iovec iov;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1092  	struct socket *sock;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1093  	unsigned msg_flags;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1094  	int ret, min_ret = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1095  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1096  	sock = sock_from_file(req->file);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1097  	if (unlikely(!sock))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1098  		return -ENOTSOCK;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1099  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1100  	msg.msg_name = NULL;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1101  	msg.msg_control = NULL;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1102  	msg.msg_controllen = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1103  	msg.msg_namelen = 0;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1104  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1105  	if (req->imu) {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1106  		ret = io_import_fixed(WRITE, &msg.msg_iter, req->imu,
0909a53e1c81ca Pavel Begunkov 2022-07-24  1107  				      (u64)(uintptr_t)zc->buf, zc->len);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1108  		if (unlikely(ret))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1109  			return ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1110  	} else {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1111  		return -EFAULT;
                                                                ^^^^^^^^^^^^^^^

0909a53e1c81ca Pavel Begunkov 2022-07-24  1112  
0909a53e1c81ca Pavel Begunkov 2022-07-24 @1113  		ret = import_single_range(WRITE, zc->buf, zc->len, &iov,
0909a53e1c81ca Pavel Begunkov 2022-07-24  1114  					  &msg.msg_iter);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1115  		if (unlikely(ret))
0909a53e1c81ca Pavel Begunkov 2022-07-24  1116  			return ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1117  		/* TODO: add pinning accounting */
0909a53e1c81ca Pavel Begunkov 2022-07-24  1118  	}
0909a53e1c81ca Pavel Begunkov 2022-07-24  1119  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1120  	msg_flags = zc->msg_flags | MSG_ZEROCOPY;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1121  	if (issue_flags & IO_URING_F_NONBLOCK)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1122  		msg_flags |= MSG_DONTWAIT;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1123  	if (msg_flags & MSG_WAITALL)
0909a53e1c81ca Pavel Begunkov 2022-07-24  1124  		min_ret = iov_iter_count(&msg.msg_iter);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1125  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1126  	msg.msg_flags = msg_flags;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1127  	msg.msg_ubuf = &zc->ubuf;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1128  	msg.sg_from_iter = io_sg_from_iter;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1129  	ret = sock_sendmsg(sock, &msg);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1130  
0909a53e1c81ca Pavel Begunkov 2022-07-24  1131  	req->cqe.res = ret;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1132  	if (refcount_dec_and_test(&zc->ubuf.refcnt)) {
0909a53e1c81ca Pavel Begunkov 2022-07-24  1133  		io_req_set_res(req, req->cqe.res, 0);
0909a53e1c81ca Pavel Begunkov 2022-07-24  1134  		return IOU_OK;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1135  	}
0909a53e1c81ca Pavel Begunkov 2022-07-24  1136  	return IOU_ISSUE_SKIP_COMPLETE;
0909a53e1c81ca Pavel Begunkov 2022-07-24  1137  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ