[isilence:zc_perf_tests 10/10] io_uring/net.c:1094:18: warning: variable 'min_ret' set but not used

From: kernel test robot
Date: Mon Jul 25 2022 - 08:21:33 EST


tree: https://github.com/isilence/linux zc_perf_tests
head: 0909a53e1c81ca9432cbb58d15b87e500595bcbd
commit: 0909a53e1c81ca9432cbb58d15b87e500595bcbd [10/10] io_uring: simple zc
config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20220725/202207252009.1dAju6CG-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/isilence/linux/commit/0909a53e1c81ca9432cbb58d15b87e500595bcbd
git remote add isilence https://github.com/isilence/linux
git fetch --no-tags isilence zc_perf_tests
git checkout 0909a53e1c81ca9432cbb58d15b87e500595bcbd
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

io_uring/net.c: In function 'io_sendzc1':
>> io_uring/net.c:1094:18: warning: variable 'min_ret' set but not used [-Wunused-but-set-variable]
1094 | int ret, min_ret = 0;
| ^~~~~~~


vim +/min_ret +1094 io_uring/net.c

1086
1087 int io_sendzc1(struct io_kiocb *req, unsigned int issue_flags)
1088 {
1089 struct io_sendzc1 *zc = io_kiocb_to_cmd(req);
1090 struct msghdr msg;
1091 struct iovec iov;
1092 struct socket *sock;
1093 unsigned msg_flags;
> 1094 int ret, min_ret = 0;
1095
1096 sock = sock_from_file(req->file);
1097 if (unlikely(!sock))
1098 return -ENOTSOCK;
1099
1100 msg.msg_name = NULL;
1101 msg.msg_control = NULL;
1102 msg.msg_controllen = 0;
1103 msg.msg_namelen = 0;
1104
1105 if (req->imu) {
1106 ret = io_import_fixed(WRITE, &msg.msg_iter, req->imu,
1107 (u64)(uintptr_t)zc->buf, zc->len);
1108 if (unlikely(ret))
1109 return ret;
1110 } else {
1111 return -EFAULT;
1112
1113 ret = import_single_range(WRITE, zc->buf, zc->len, &iov,
1114 &msg.msg_iter);
1115 if (unlikely(ret))
1116 return ret;
1117 /* TODO: add pinning accounting */
1118 }
1119
1120 msg_flags = zc->msg_flags | MSG_ZEROCOPY;
1121 if (issue_flags & IO_URING_F_NONBLOCK)
1122 msg_flags |= MSG_DONTWAIT;
1123 if (msg_flags & MSG_WAITALL)
1124 min_ret = iov_iter_count(&msg.msg_iter);
1125
1126 msg.msg_flags = msg_flags;
1127 msg.msg_ubuf = &zc->ubuf;
1128 msg.sg_from_iter = io_sg_from_iter;
1129 ret = sock_sendmsg(sock, &msg);
1130
1131 req->cqe.res = ret;
1132 if (refcount_dec_and_test(&zc->ubuf.refcnt)) {
1133 io_req_set_res(req, req->cqe.res, 0);
1134 return IOU_OK;
1135 }
1136 return IOU_ISSUE_SKIP_COMPLETE;
1137 }
1138

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