[vfs:untested-uaccess 46/79] arch/mips/include/asm/uaccess.h:138:2: note: in expansion of macro 'likely'

[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 untested-uaccess
head:   e4c5cc79ec8eab6bc3e74d9994b33f368f137223
commit: 6efb94be5437e7943854e8a60fc0cc7f280232e2 [46/79] mips: sanitize __access_ok()
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 6efb94be5437e7943854e8a60fc0cc7f280232e2
        # save the attached .config to linux build tree
        make.cross ARCH=mips 

All warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/uapi/linux/capability.h:16,
                    from include/linux/capability.h:15,
                    from arch/mips/kernel/syscall.c:10:
   arch/mips/kernel/syscall.c: In function 'mips_atomic_set':
   arch/mips/include/asm/uaccess.h:138:21: error: passing argument 1 of '__access_ok' makes pointer from integer without a cast [-Werror=int-conversion]
     likely(__access_ok((addr), (size)))
                        ^
   include/linux/compiler.h:179:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^
>> arch/mips/include/asm/uaccess.h:138:2: note: in expansion of macro 'likely'
     likely(__access_ok((addr), (size)))
     ^~~~~~
>> arch/mips/kernel/syscall.c:101:16: note: in expansion of macro 'access_ok'
     if (unlikely(!access_ok(VERIFY_WRITE, addr, 4)))
                   ^~~~~~~~~
   In file included from include/linux/uaccess.h:13:0,
                    from include/linux/poll.h:11,
                    from include/linux/ring_buffer.h:7,
                    from include/linux/trace_events.h:5,
                    from include/trace/syscall.h:6,
                    from include/linux/syscalls.h:82,
                    from arch/mips/kernel/syscall.c:17:
   arch/mips/include/asm/uaccess.h:131:19: note: expected 'const void *' but argument is of type 'long unsigned int'
    static inline int __access_ok(const void __user *p, unsigned long size)
                      ^~~~~~~~~~~
   cc1: all warnings being treated as errors
--
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/uapi/linux/capability.h:16,
                    from include/linux/capability.h:15,
                    from arch/mips//kernel/syscall.c:10:
   arch/mips//kernel/syscall.c: In function 'mips_atomic_set':
   arch/mips/include/asm/uaccess.h:138:21: error: passing argument 1 of '__access_ok' makes pointer from integer without a cast [-Werror=int-conversion]
     likely(__access_ok((addr), (size)))
                        ^
   include/linux/compiler.h:179:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^
>> arch/mips/include/asm/uaccess.h:138:2: note: in expansion of macro 'likely'
     likely(__access_ok((addr), (size)))
     ^~~~~~
   arch/mips//kernel/syscall.c:101:16: note: in expansion of macro 'access_ok'
     if (unlikely(!access_ok(VERIFY_WRITE, addr, 4)))
                   ^~~~~~~~~
   In file included from include/linux/uaccess.h:13:0,
                    from include/linux/poll.h:11,
                    from include/linux/ring_buffer.h:7,
                    from include/linux/trace_events.h:5,
                    from include/trace/syscall.h:6,
                    from include/linux/syscalls.h:82,
                    from arch/mips//kernel/syscall.c:17:
   arch/mips/include/asm/uaccess.h:131:19: note: expected 'const void *' but argument is of type 'long unsigned int'
    static inline int __access_ok(const void __user *p, unsigned long size)
                      ^~~~~~~~~~~
   cc1: all warnings being treated as errors

vim +/likely +138 arch/mips/include/asm/uaccess.h

   122	 *
   123	 * Returns true (nonzero) if the memory block may be valid, false (zero)
   124	 * if it is definitely invalid.
   125	 *
   126	 * Note that, depending on architecture, this function probably just
   127	 * checks that the pointer is in the user space range - after calling
   128	 * this function, memory access functions may still return -EFAULT.
   129	 */
   130	
   131	static inline int __access_ok(const void __user *p, unsigned long size)
   132	{
   133		unsigned long addr = (unsigned long)p;
   134		return (get_fs().seg & (addr | (addr + size) | __ua_size(size))) == 0;
   135	}
   136	
   137	#define access_ok(type, addr, size)					\
 > 138		likely(__access_ok((addr), (size)))
   139	
   140	/*
   141	 * put_user: - Write a simple value into user space.
   142	 * @x:	 Value to copy to user space.
   143	 * @ptr: Destination address, in user space.
   144	 *
   145	 * Context: User context only. This function may sleep if pagefaults are
   146	 *          enabled.

---
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