Skip to content

Commit

Permalink
m68k,nommu: fix implicit cast from __user in __{get,put}_user_asm()
Browse files Browse the repository at this point in the history
The assembly for __get_user_asm() & __put_user_asm() uses memcpy()
when the size is 8.

However, the pointer is always a __user one while memcpy() expects
a plain one and so this cast creates a lot of warnings when using
Sparse.

So, fix this by adding a cast to 'void __force *' at memcpy()'s
argument.

Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Luc Van Oostenryck <[email protected]>
Signed-off-by: Greg Ungerer <[email protected]>
  • Loading branch information
lucvoo authored and Greg Ungerer committed May 30, 2020
1 parent ce3e837 commit 9e2b6ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/m68k/include/asm/uaccess_no.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static inline int _access_ok(unsigned long addr, unsigned long size)
__put_user_asm(__pu_err, __pu_val, ptr, l); \
break; \
case 8: \
memcpy(ptr, &__pu_val, sizeof (*(ptr))); \
memcpy((void __force *)ptr, &__pu_val, sizeof(*(ptr))); \
break; \
default: \
__pu_err = __put_user_bad(); \
Expand Down Expand Up @@ -85,7 +85,7 @@ extern int __put_user_bad(void);
u64 l; \
__typeof__(*(ptr)) t; \
} __gu_val; \
memcpy(&__gu_val.l, ptr, sizeof(__gu_val.l)); \
memcpy(&__gu_val.l, (const void __force *)ptr, sizeof(__gu_val.l)); \
(x) = __gu_val.t; \
break; \
} \
Expand Down

0 comments on commit 9e2b6ed

Please sign in to comment.