Hi Breno, kernel test robot noticed the following build warnings: [auto build test WARNING on mptcp/export] [also build test WARNING on mptcp/export-net net-next/main net/main linus/master v6.4-rc2 next-20230519] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Breno-Leitao/net-ioctl-Use-kernel-memory-on-protocol-ioctl-callbacks/20230519-223824 base: https://github.com/multipath-tcp/mptcp_net-next.git export patch link: https://lore.kernel.org/r/20230519135821.922326-2-leitao%40debian.org patch subject: [PATCH 1/1] net: ioctl: Use kernel memory on protocol ioctl callbacks config: hexagon-randconfig-r045-20230517 compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project b0fb98227c90adf2536c9ad644a74d5e92961111) 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/intel-lab-lkp/linux/commit/95a4f4f84bf68692f5b42921c9f6067c0986aed8 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Breno-Leitao/net-ioctl-Use-kernel-memory-on-protocol-ioctl-callbacks/20230519-223824 git checkout 95a4f4f84bf68692f5b42921c9f6067c0986aed8 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash net/core/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202305200317.Cms0i6RK-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from net/core/sock.c:91: In file included from include/linux/errqueue.h:6: In file included from include/net/ip.h:22: In file included from include/linux/ip.h:16: In file included from include/linux/skbuff.h:17: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) ^ In file included from net/core/sock.c:91: In file included from include/linux/errqueue.h:6: In file included from include/net/ip.h:22: In file included from include/linux/ip.h:16: In file included from include/linux/skbuff.h:17: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) ^ In file included from net/core/sock.c:91: In file included from include/linux/errqueue.h:6: In file included from include/net/ip.h:22: In file included from include/linux/ip.h:16: In file included from include/linux/skbuff.h:17: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ >> net/core/sock.c:4114:5: warning: no previous prototype for function 'sock_skproto_ioctl_in' [-Wmissing-prototypes] int sock_skproto_ioctl_in(struct sock *sk, unsigned int cmd, ^ net/core/sock.c:4114:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int sock_skproto_ioctl_in(struct sock *sk, unsigned int cmd, ^ static >> net/core/sock.c:4126:5: warning: no previous prototype for function 'sock_skproto_ioctl_inout' [-Wmissing-prototypes] int sock_skproto_ioctl_inout(struct sock *sk, unsigned int cmd, ^ net/core/sock.c:4126:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int sock_skproto_ioctl_inout(struct sock *sk, unsigned int cmd, ^ static >> net/core/sock.c:4157:5: warning: no previous prototype for function 'sock_skproto_ioctl_out' [-Wmissing-prototypes] int sock_skproto_ioctl_out(struct sock *sk, unsigned int cmd, ^ net/core/sock.c:4157:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int sock_skproto_ioctl_out(struct sock *sk, unsigned int cmd, ^ static 9 warnings generated. vim +/sock_skproto_ioctl_in +4114 net/core/sock.c 4112 4113 /* Copy 'size' bytes from userspace and do not copy anything back */ > 4114 int sock_skproto_ioctl_in(struct sock *sk, unsigned int cmd, 4115 void __user *arg) 4116 { 4117 int karg; 4118 4119 if (get_user(karg, (u32 __user *)arg)) 4120 return -EFAULT; 4121 4122 return sk->sk_prot->ioctl(sk, cmd, &karg); 4123 } 4124 4125 /* Copy 'size' bytes from userspace and return `size` back to userspace */ > 4126 int sock_skproto_ioctl_inout(struct sock *sk, unsigned int cmd, 4127 void __user *arg, size_t size) 4128 { 4129 void *ptr; 4130 int ret; 4131 4132 ptr = kmalloc(size, GFP_KERNEL); 4133 if (!ptr) 4134 return -ENOMEM; 4135 4136 if (copy_from_user(ptr, arg, size)) { 4137 ret = -EFAULT; 4138 goto out; 4139 } 4140 4141 ret = sk->sk_prot->ioctl(sk, cmd, ptr); 4142 if (ret) 4143 goto out; 4144 4145 if (copy_to_user(arg, ptr, size)) 4146 ret = -EFAULT; 4147 4148 out: 4149 kfree(ptr); 4150 return ret; 4151 } 4152 4153 /* This is the most common ioctl prep function, where the result (4 bytes) is 4154 * copied back to userspace if the ioctl() returns successfully. No input is 4155 * copied from userspace as input argument. 4156 */ > 4157 int sock_skproto_ioctl_out(struct sock *sk, unsigned int cmd, 4158 void __user *arg) 4159 { 4160 int ret, karg = 0; 4161 4162 ret = sk->sk_prot->ioctl(sk, cmd, &karg); 4163 if (ret) 4164 return ret; 4165 4166 return put_user(karg, (int __user *)arg); 4167 } 4168 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki