Re: [net-next, v4, 08/11] net: sock: extend SO_TIMESTAMPING for PHC binding

From: kernel test robot
Date: Fri Jun 25 2021 - 10:20:08 EST


Hi Yangbo,

I love your patch! Perhaps something to improve:

[auto build test WARNING on 19938bafa7ae8fc0a4a2c1c1430abb1a04668da1]

url: https://github.com/0day-ci/linux/commits/Yangbo-Lu/ptp-support-virtual-clocks-and-timestamping/20210625-172554
base: 19938bafa7ae8fc0a4a2c1c1430abb1a04668da1
config: x86_64-randconfig-r013-20210625 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9ca0171a9ffdef5fdb1511d197a3fd72490362de)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/e6720a23e3833ed72016804e74875c63c8f2c414
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yangbo-Lu/ptp-support-virtual-clocks-and-timestamping/20210625-172554
git checkout e6720a23e3833ed72016804e74875c63c8f2c414
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

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

All warnings (new ones prefixed by >>):

net/mptcp/sockopt.c:218:45: error: indirection requires pointer operand ('int' invalid)
if (copy_from_sockptr(val, optval, sizeof(*val)))
^~~~
>> net/mptcp/sockopt.c:218:25: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'void *' [-Wint-conversion]
if (copy_from_sockptr(val, optval, sizeof(*val)))
^~~
include/linux/sockptr.h:53:43: note: passing argument to parameter 'dst' here
static inline int copy_from_sockptr(void *dst, sockptr_t src, size_t size)
^
1 warning and 1 error generated.


vim +218 net/mptcp/sockopt.c

202
203 static int mptcp_setsockopt_sol_socket_timestamping(struct mptcp_sock *msk,
204 int optname,
205 sockptr_t optval,
206 unsigned int optlen)
207 {
208 struct mptcp_subflow_context *subflow;
209 struct sock *sk = (struct sock *)msk;
210 struct so_timestamping timestamping;
211 int val, ret;
212
213 if (optlen == sizeof(timestamping)) {
214 if (copy_from_sockptr(&timestamping, optval,
215 sizeof(timestamping)))
216 return -EFAULT;
217 } else if (optlen == sizeof(int)) {
> 218 if (copy_from_sockptr(val, optval, sizeof(*val)))
219 return -EFAULT;
220
221 memset(&timestamping, 0, sizeof(timestamping));
222 timestamping.flags = val;
223 } else {
224 return -EINVAL;
225 }
226
227 ret = sock_setsockopt(sk->sk_socket, SOL_SOCKET, optname,
228 KERNEL_SOCKPTR(&timestamping),
229 sizeof(timestamping));
230 if (ret)
231 return ret;
232
233 lock_sock(sk);
234
235 mptcp_for_each_subflow(msk, subflow) {
236 struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
237 bool slow = lock_sock_fast(ssk);
238
239 sock_set_timestamping(sk, optname, timestamping);
240 unlock_sock_fast(ssk, slow);
241 }
242
243 release_sock(sk);
244
245 return 0;
246 }
247

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

Attachment: .config.gz
Description: application/gzip