Skip to content

Commit

Permalink
sh: Proper __put_user_asm() size mismatch fix.
Browse files Browse the repository at this point in the history
This fixes up the workaround in 2b4b2bb
and cleans up __put_user_asm() to get the sizing right from the onset.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
OGAWA Hirofumi authored and Paul Mundt committed Jul 29, 2008
1 parent d27e085 commit 6de9c64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions arch/sh/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,19 @@ struct __large_struct { unsigned long buf[100]; };
({ \
long __pu_err; \
__typeof__(*(ptr)) __user *__pu_addr = (ptr); \
__typeof__(*(ptr)) __pu_val = x; \
__chk_user_ptr(ptr); \
__put_user_size((x), __pu_addr, (size), __pu_err); \
__put_user_size(__pu_val, __pu_addr, (size), __pu_err); \
__pu_err; \
})

#define __put_user_check(x,ptr,size) \
({ \
long __pu_err = -EFAULT; \
__typeof__(*(ptr)) __user *__pu_addr = (ptr); \
__typeof__(*(ptr)) __pu_val = x; \
if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) \
__put_user_size((x), __pu_addr, (size), \
__put_user_size(__pu_val, __pu_addr, (size), \
__pu_err); \
__pu_err; \
})
Expand Down
3 changes: 1 addition & 2 deletions arch/sh/include/asm/uaccess_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ do { \
__put_user_asm(x, ptr, retval, "w"); \
break; \
case 4: \
__put_user_asm((u32)x, ptr, \
retval, "l"); \
__put_user_asm(x, ptr, retval, "l"); \
break; \
case 8: \
__put_user_u64(x, ptr, retval); \
Expand Down

0 comments on commit 6de9c64

Please sign in to comment.