提交 10ea25c2 编写于 作者: B Bixuan Cui 提交者: Yang Yingliang

powerpc: fix a compiling error for 'access_ok'

hulk inclusion
category: bugfix
bugzilla: NA
CVE: NA

An error is reported during powerpc platform compilation because
VERIFY_WRITE is already removed in powerpc platform.

    ./arch/powerpc/include/asm/uaccess.h: In function ‘clear_user’:
    ./arch/powerpc/include/asm/uaccess.h:446:48: error: macro "access_ok" passed 3 arguments, but takes just 2
      if (likely(access_ok(VERIFY_WRITE, addr, size))) {
                                                    ^
    In file included from ./include/asm-generic/div64.h:25:0,
                     from ./arch/powerpc/include/generated/asm/div64.h:1,
                     from ./include/linux/math64.h:6,
                     from ./include/linux/time64.h:5,
                     from ./include/linux/compat_time.h:6,
                     from ./include/linux/compat.h:10,
                     from arch/powerpc/kernel/asm-offsets.c:16:
    ./arch/powerpc/include/asm/uaccess.h:446:13: error: ‘access_ok’ undeclared (first use in this function)
      if (likely(access_ok(VERIFY_WRITE, addr, size))) {
                 ^
    ./include/linux/compiler.h:76:40: note: in definition of macro ‘likely’
     # define likely(x) __builtin_expect(!!(x), 1)
                                            ^
    ./arch/powerpc/include/asm/uaccess.h:446:13: note: each undeclared identifier is reported only once for each function it appears in
      if (likely(access_ok(VERIFY_WRITE, addr, size))) {
                 ^
    ./include/linux/compiler.h:76:40: note: in definition of macro ‘likely’
     # define likely(x) __builtin_expect(!!(x), 1)
                                            ^
    Kbuild:56: recipe for target 'arch/powerpc/kernel/asm-offsets.s' failed

Fixes: 837baab68b87 ("powerpc: Add a framework for user access tracking")
Fixes: a10f8b4fe993 ("powerpc: Implement user_access_begin and friends")
Signed-off-by: NBixuan Cui <cuibixuan@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 9ced0cc2
......@@ -443,7 +443,7 @@ static inline unsigned long clear_user(void __user *addr, unsigned long size)
{
unsigned long ret = size;
might_fault();
if (likely(access_ok(VERIFY_WRITE, addr, size))) {
if (likely(access_ok(addr, size))) {
allow_write_to_user(addr, size);
ret = __arch_clear_user(addr, size);
prevent_write_to_user(addr, size);
......@@ -464,7 +464,7 @@ extern long __copy_from_user_flushcache(void *dst, const void __user *src,
extern void memcpy_page_flushcache(char *to, struct page *page, size_t offset,
size_t len);
#define user_access_begin(type, ptr, len) access_ok(type, ptr, len)
#define user_access_begin(ptr, len) access_ok(ptr, len)
#define user_access_end() prevent_user_access(NULL, NULL, ~0ul)
#define unsafe_op_wrap(op, err) do { if (unlikely(op)) goto err; } while (0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册