aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/io_trapped.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2022-02-11 17:26:42 +0100
committerArnd Bergmann <arnd@arndb.de>2022-02-25 09:36:06 +0100
commit75d4d29549e54c61466d60336b1c6e3a5d28797c (patch)
tree48442ed7077e34e60c9bc34438c11a804800d9fe /arch/sh/kernel/io_trapped.c
parentsparc64: remove CONFIG_SET_FS support (diff)
downloadlinux-dev-75d4d29549e54c61466d60336b1c6e3a5d28797c.tar.xz
linux-dev-75d4d29549e54c61466d60336b1c6e3a5d28797c.zip
sh: remove CONFIG_SET_FS support
sh uses set_fs/get_fs only in one file, to handle address errors in both user and kernel memory. It already has an abstraction to differentiate between I/O and memory, so adding a third class for kernel memory fits into the same scheme and lets us kill off CONFIG_SET_FS. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/sh/kernel/io_trapped.c')
-rw-r--r--arch/sh/kernel/io_trapped.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
index 004ad0130b10..e803b14ef12e 100644
--- a/arch/sh/kernel/io_trapped.c
+++ b/arch/sh/kernel/io_trapped.c
@@ -270,7 +270,6 @@ static struct mem_access trapped_io_access = {
int handle_trapped_io(struct pt_regs *regs, unsigned long address)
{
- mm_segment_t oldfs;
insn_size_t instruction;
int tmp;
@@ -281,16 +280,12 @@ int handle_trapped_io(struct pt_regs *regs, unsigned long address)
WARN_ON(user_mode(regs));
- oldfs = get_fs();
- set_fs(KERNEL_DS);
- if (copy_from_user(&instruction, (void *)(regs->pc),
- sizeof(instruction))) {
- set_fs(oldfs);
+ if (copy_from_kernel_nofault(&instruction, (void *)(regs->pc),
+ sizeof(instruction))) {
return 0;
}
tmp = handle_unaligned_access(instruction, regs,
&trapped_io_access, 1, address);
- set_fs(oldfs);
return tmp == 0;
}