History

x86: remove more uaccess_32.h complexity

I'm looking at trying to possibly merge the 32-bit and 64-bit versions of the x86 uaccess.h implementation, but first this needs to be cleaned up. For example, the 32-bit version of "__copy_from_user_inatomic()" is mostly the special cases for the constant size, and it's actually almost never relevant. Most users aren't actually using a constant size anyway, and the few cases that do small constant copies are better off just using __get_user() instead. So get rid of the unnecessary complexity.

Linus Torvalds committed 10 years ago

Commit bd28b141 parent 5b09c3e4 files · +3 −31Browse files

Showing the changes to kernel (2 of 4 files). Show all

Unified · Split

2 files
  1. kernel/events/uprobes.c +1 −2
  2. kernel/futex.c +1 −1
kernel/events/uprobes.c+1−2
@@ -1694,8 +1694,7 @@ static int is_trap_at_addr(struct mm_struct *mm, unsigned long vaddr) · 1693 unmodified lines
1694 int result;1694 int result;
1695 1695
1696 pagefault_disable();1696 pagefault_disable();
1697 result = __copy_from_user_inatomic(&opcode, (void __user*)vaddr,1697 result = __get_user(opcode, (uprobe_opcode_t __user *)vaddr);
1698 sizeof(opcode));
1699 pagefault_enable();1698 pagefault_enable();
1700 1699
1701 if (likely(result == 0))1700 if (likely(result == 0))
kernel/futex.c+1−1
@@ -729,7 +729,7 @@ static int get_futex_value_locked(u32 *dest, u32 __user *from) · 728 unmodified lines
729 int ret;729 int ret;
730 730
731 pagefault_disable();731 pagefault_disable();
732 ret = __copy_from_user_inatomic(dest, from, sizeof(u32));732 ret = __get_user(*dest, from);
733 pagefault_enable();733 pagefault_enable();
734 734
735 return ret ? -EFAULT : 0;735 return ret ? -EFAULT : 0;