diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-15 20:17:52 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-15 20:17:52 +0200 |
commit | 89cbec71fead552fdd1fa38c57186669dfbba734 (patch) | |
tree | 0e8e235b23b0fc1cd2d32bb28cafdee636e62d51 /arch/m68k | |
parent | Merge branch 'misc.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/v... (diff) | |
parent | kill {__,}{get,put}_user_unaligned() (diff) | |
download | linux-89cbec71fead552fdd1fa38c57186669dfbba734.tar.xz linux-89cbec71fead552fdd1fa38c57186669dfbba734.zip |
Merge branch 'work.uaccess-unaligned' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull uacess-unaligned removal from Al Viro:
"That stuff had just one user, and an exotic one, at that - binfmt_flat
on arm and m68k"
* 'work.uaccess-unaligned' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
kill {__,}{get,put}_user_unaligned()
binfmt_flat: flat_{get,put}_addr_from_rp() should be able to fail
Diffstat (limited to 'arch/m68k')
-rw-r--r-- | arch/m68k/include/asm/flat.h | 23 | ||||
-rw-r--r-- | arch/m68k/include/asm/uaccess.h | 7 |
2 files changed, 20 insertions, 10 deletions
diff --git a/arch/m68k/include/asm/flat.h b/arch/m68k/include/asm/flat.h index 00c392b0cabd..48b62790fe70 100644 --- a/arch/m68k/include/asm/flat.h +++ b/arch/m68k/include/asm/flat.h @@ -5,12 +5,29 @@ #ifndef __M68KNOMMU_FLAT_H__ #define __M68KNOMMU_FLAT_H__ +#include <linux/uaccess.h> + #define flat_argvp_envp_on_stack() 1 #define flat_old_ram_flag(flags) (flags) #define flat_reloc_valid(reloc, size) ((reloc) <= (size)) -#define flat_get_addr_from_rp(rp, relval, flags, p) \ - ({ unsigned long __val; __get_user_unaligned(__val, rp); __val; }) -#define flat_put_addr_at_rp(rp, val, relval) __put_user_unaligned(val, rp) +static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags, + u32 *addr, u32 *persistent) +{ +#ifdef CONFIG_CPU_HAS_NO_UNALIGNED + return copy_from_user(addr, rp, 4) ? -EFAULT : 0; +#else + return get_user(*addr, rp); +#endif +} + +static inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel) +{ +#ifdef CONFIG_CPU_HAS_NO_UNALIGNED + return copy_to_user(rp, &addr, 4) ? -EFAULT : 0; +#else + return put_user(addr, rp); +#endif +} #define flat_get_relocate_addr(rel) (rel) static inline int flat_set_persistent(unsigned long relval, diff --git a/arch/m68k/include/asm/uaccess.h b/arch/m68k/include/asm/uaccess.h index 67b3481d6020..63ba18e4c9a2 100644 --- a/arch/m68k/include/asm/uaccess.h +++ b/arch/m68k/include/asm/uaccess.h @@ -3,11 +3,4 @@ #else #include <asm/uaccess_mm.h> #endif - #include <asm/extable.h> -#ifdef CONFIG_CPU_HAS_NO_UNALIGNED -#include <asm-generic/uaccess-unaligned.h> -#else -#define __get_user_unaligned(x, ptr) __get_user((x), (ptr)) -#define __put_user_unaligned(x, ptr) __put_user((x), (ptr)) -#endif |