maccess.c (cdd38c5f1ce4398ec58fec95904b75824daab7b5) maccess.c (39352430aaa05fbe4ba710231c70b334513078f2)
1// SPDX-License-Identifier: GPL-2.0-only
2
3#include <linux/uaccess.h>
4#include <linux/kernel.h>
5
1// SPDX-License-Identifier: GPL-2.0-only
2
3#include <linux/uaccess.h>
4#include <linux/kernel.h>
5
6#include <asm/disassemble.h>
7#include <asm/inst.h>
8#include <asm/ppc-opcode.h>
9
6bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)
7{
8 return is_kernel_addr((unsigned long)unsafe_src);
9}
10bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)
11{
12 return is_kernel_addr((unsigned long)unsafe_src);
13}
14
15int copy_inst_from_kernel_nofault(struct ppc_inst *inst, struct ppc_inst *src)
16{
17 unsigned int val, suffix;
18 int err;
19
20 err = copy_from_kernel_nofault(&val, src, sizeof(val));
21 if (err)
22 return err;
23 if (IS_ENABLED(CONFIG_PPC64) && get_op(val) == OP_PREFIX) {
24 err = copy_from_kernel_nofault(&suffix, (void *)src + 4, 4);
25 *inst = ppc_inst_prefix(val, suffix);
26 } else {
27 *inst = ppc_inst(val);
28 }
29 return err;
30}