powerpc/inst: Add __copy_inst_from_kernel_nofault()
On the same model as get_user() versus __get_user(), introduce __copy_inst_from_kernel_nofault() which doesn't check address. To be used by callers that have already checked that the adress is a kernel address. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/1f3702890d6dbd64702b61834753bcc96851c18c.1652074503.git.christophe.leroy@csgroup.eu
This commit is contained in:
parent
af8b9f352f
commit
8dfdbe4368
|
@ -158,13 +158,10 @@ static inline char *__ppc_inst_as_str(char str[PPC_INST_STR_LEN], ppc_inst_t x)
|
|||
__str; \
|
||||
})
|
||||
|
||||
static inline int copy_inst_from_kernel_nofault(ppc_inst_t *inst, u32 *src)
|
||||
static inline int __copy_inst_from_kernel_nofault(ppc_inst_t *inst, u32 *src)
|
||||
{
|
||||
unsigned int val, suffix;
|
||||
|
||||
if (unlikely(!is_kernel_addr((unsigned long)src)))
|
||||
return -ERANGE;
|
||||
|
||||
/* See https://github.com/ClangBuiltLinux/linux/issues/1521 */
|
||||
#if defined(CONFIG_CC_IS_CLANG) && CONFIG_CLANG_VERSION < 140000
|
||||
val = suffix = 0;
|
||||
|
@ -181,4 +178,12 @@ Efault:
|
|||
return -EFAULT;
|
||||
}
|
||||
|
||||
static inline int copy_inst_from_kernel_nofault(ppc_inst_t *inst, u32 *src)
|
||||
{
|
||||
if (unlikely(!is_kernel_addr((unsigned long)src)))
|
||||
return -ERANGE;
|
||||
|
||||
return __copy_inst_from_kernel_nofault(inst, src);
|
||||
}
|
||||
|
||||
#endif /* _ASM_POWERPC_INST_H */
|
||||
|
|
Loading…
Reference in New Issue