[congwang:bpf2 3/4] net/core/skmsg.c:482:38: warning: passing argument 1 of 'sk_psock_get_checked' discards 'const' qualifier from pointer target type

From: kernel test robot
Date: Mon Sep 27 2021 - 19:23:39 EST


tree: https://github.com/congwang/linux.git bpf2
head: ec3836e59604af89a5f07045ea7a3a1f60ff2cf4
commit: 5417d71bbf55e2a31ceba94cc0d1e4912354c67e [3/4] net: implement ->sock_is_readable for UDP and AF_UNIX
config: openrisc-buildonly-randconfig-r006-20210927 (attached as .config)
compiler: or1k-linux-gcc (GCC) 11.2.0
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
# https://github.com/congwang/linux/commit/5417d71bbf55e2a31ceba94cc0d1e4912354c67e
git remote add congwang https://github.com/congwang/linux.git
git fetch --no-tags congwang bpf2
git checkout 5417d71bbf55e2a31ceba94cc0d1e4912354c67e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=openrisc

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/core/skmsg.c: In function 'sk_msg_is_readable':
>> net/core/skmsg.c:482:38: warning: passing argument 1 of 'sk_psock_get_checked' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
482 | psock = sk_psock_get_checked(sk);
| ^~
In file included from net/core/skmsg.c:4:
include/linux/skmsg.h:456:66: note: expected 'struct sock *' but argument is of type 'const struct sock *'
456 | static inline struct sk_psock *sk_psock_get_checked(struct sock *sk)
| ~~~~~~~~~~~~~^~
>> net/core/skmsg.c:486:22: warning: passing argument 1 of 'sk_psock_put' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
486 | sk_psock_put(sk, psock);
| ^~
In file included from net/core/skmsg.c:4:
include/linux/skmsg.h:478:46: note: expected 'struct sock *' but argument is of type 'const struct sock *'
478 | static inline void sk_psock_put(struct sock *sk, struct sk_psock *psock)
| ~~~~~~~~~~~~~^~


vim +482 net/core/skmsg.c

476
477 bool sk_msg_is_readable(const struct sock *sk)
478 {
479 struct sk_psock *psock;
480 bool empty = true;
481
> 482 psock = sk_psock_get_checked(sk);
483 if (IS_ERR_OR_NULL(psock))
484 return false;
485 empty = sk_psock_queue_empty(psock);
> 486 sk_psock_put(sk, psock);
487 return !empty;
488 }
489 EXPORT_SYMBOL_GPL(skmsg_is_readable);
490

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

Attachment: .config.gz
Description: application/gzip