uaccess: add generic fallback version of copy_mc_to_user()
ANBZ: #6424 cherry-picked from https://lore.kernel.org/lkml/20230508014436.198717-1-tongtiangen@huawei.com/. x86/powerpc has it's implementation of copy_mc_to_user(), we add generic fallback in include/linux/uaccess.h prepare for other architechures to enable CONFIG_ARCH_HAS_COPY_MC. Signed-off-by: Tong Tiangen <tongtiangen@huawei.com> Acked-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Ruidong Tian <tianruidong@linux.alibaba.com> Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Link: https://gitee.com/anolis/cloud-kernel/pulls/2131
This commit is contained in:
parent
1100488ba9
commit
6ff9eb0eec
|
@ -388,6 +388,7 @@ copy_mc_to_user(void __user *to, const void *from, unsigned long n)
|
|||
|
||||
return n;
|
||||
}
|
||||
#define copy_mc_to_user copy_mc_to_user
|
||||
#endif
|
||||
|
||||
#ifdef __powerpc64__
|
||||
|
|
|
@ -447,6 +447,7 @@ copy_mc_to_kernel(void *to, const void *from, unsigned len);
|
|||
|
||||
unsigned long __must_check
|
||||
copy_mc_to_user(void *to, const void *from, unsigned len);
|
||||
#define copy_mc_to_user copy_mc_to_user
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -224,6 +224,15 @@ copy_mc_to_kernel(void *dst, const void *src, size_t cnt)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef copy_mc_to_user
|
||||
static inline unsigned long __must_check
|
||||
copy_mc_to_user(void *dst, const void *src, size_t cnt)
|
||||
{
|
||||
check_object_size(src, cnt, true);
|
||||
return raw_copy_to_user(dst, src, cnt);
|
||||
}
|
||||
#endif
|
||||
|
||||
static __always_inline void pagefault_disabled_inc(void)
|
||||
{
|
||||
current->pagefault_disabled++;
|
||||
|
|
Loading…
Reference in New Issue