mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Pavel Begunkov <asml.silence@gmail.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: [isilence:zc_perf_tests 10/10] io_uring/net.c:1113 io_sendzc1() warn: ignoring unreachable code.
Date: Tue, 26 Jul 2022 18:58:24 +0300	[thread overview]
Message-ID: <202207261540.tELcS8V6-lkp@intel.com> (raw)

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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.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


                 reply	other threads:[~2022-07-26 15:58 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=202207261540.tELcS8V6-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=asml.silence@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /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®