[vfs:misc.compat 18/20] net/compat.c:324:2: note: in expansion of macro 'if'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git misc.compat
head:   bc73ff4b6ab8549dcb1a6b253b4afeae3e2f8b32
commit: e89802c72a15385e22af7acd747fc1204dbf2827 [18/20] get_compat_bpf_fprog(): don't copyin field-by-field
config: x86_64-randconfig-u0-06292314 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        git checkout e89802c72a15385e22af7acd747fc1204dbf2827
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/compat.c:14:
   net/compat.c: In function 'get_compat_bpf_fprog':
   net/compat.c:324:27: error: incompatible type for argument 2 of 'copy_to_user'
     if (copy_to_user(kfprog, f, sizeof(struct sock_fprog)))
                              ^
   include/linux/compiler.h:160:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> net/compat.c:324:2: note: in expansion of macro 'if'
     if (copy_to_user(kfprog, f, sizeof(struct sock_fprog)))
     ^~
   In file included from include/net/checksum.h:25:0,
                    from include/linux/skbuff.h:31,
                    from include/linux/icmpv6.h:4,
                    from net/compat.c:19:
   include/linux/uaccess.h:164:1: note: expected 'const void *' but argument is of type 'struct sock_fprog'
    copy_to_user(void __user *to, const void *from, unsigned long n)
    ^~~~~~~~~~~~
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/compat.c:14:
   net/compat.c:324:27: error: incompatible type for argument 2 of 'copy_to_user'
     if (copy_to_user(kfprog, f, sizeof(struct sock_fprog)))
                              ^
   include/linux/compiler.h:160:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> net/compat.c:324:2: note: in expansion of macro 'if'
     if (copy_to_user(kfprog, f, sizeof(struct sock_fprog)))
     ^~
   In file included from include/net/checksum.h:25:0,
                    from include/linux/skbuff.h:31,
                    from include/linux/icmpv6.h:4,
                    from net/compat.c:19:
   include/linux/uaccess.h:164:1: note: expected 'const void *' but argument is of type 'struct sock_fprog'
    copy_to_user(void __user *to, const void *from, unsigned long n)
    ^~~~~~~~~~~~
   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from net/compat.c:14:
   net/compat.c:324:27: error: incompatible type for argument 2 of 'copy_to_user'
     if (copy_to_user(kfprog, f, sizeof(struct sock_fprog)))
                              ^
   include/linux/compiler.h:171:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> net/compat.c:324:2: note: in expansion of macro 'if'
     if (copy_to_user(kfprog, f, sizeof(struct sock_fprog)))
     ^~
   In file included from include/net/checksum.h:25:0,
                    from include/linux/skbuff.h:31,
                    from include/linux/icmpv6.h:4,
                    from net/compat.c:19:
   include/linux/uaccess.h:164:1: note: expected 'const void *' but argument is of type 'struct sock_fprog'
    copy_to_user(void __user *to, const void *from, unsigned long n)
    ^~~~~~~~~~~~

vim +/if +324 net/compat.c

   308		__scm_destroy(scm);
   309	}
   310	
   311	/* allocate a 64-bit sock_fprog on the user stack for duration of syscall. */
   312	struct sock_fprog __user *get_compat_bpf_fprog(char __user *optval)
   313	{
   314		struct compat_sock_fprog __user *fprog32 = (struct compat_sock_fprog __user *)optval;
   315		struct sock_fprog __user *kfprog = compat_alloc_user_space(sizeof(struct sock_fprog));
   316		struct compat_sock_fprog f32;
   317		struct sock_fprog f;
   318	
   319		if (copy_from_user(&f32, fprog32, sizeof(*fprog32)))
   320			return NULL;
   321		memset(&f, 0, sizeof(f));
   322		f.len = f32.len;
   323		f.filter = compat_ptr(f32.filter);
 > 324		if (copy_to_user(kfprog, f, sizeof(struct sock_fprog)))
   325			return NULL;
   326	
   327		return kfprog;
   328	}
   329	EXPORT_SYMBOL_GPL(get_compat_bpf_fprog);
   330	
   331	static int do_set_attach_filter(struct socket *sock, int level, int optname,
   332					char __user *optval, unsigned int optlen)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux