Skip to content

Commit

Permalink
xtensa: use __memset in __xtensa_clear_user
Browse files Browse the repository at this point in the history
memset on xtensa is capable of accessing user memory, but KASAN checks
if memset function is actually used for that and reports it as an error:

 ==================================================================
 BUG: KASAN: user-memory-access in padzero+0x4d/0x58
 Write of size 519 at addr 0049ddf9 by task init/1

 Call Trace:
  [<b0189978>] kasan_report+0x160/0x238
  [<b0188818>] check_memory_region+0xf8/0x100
  [<b018891c>] memset+0x20/0x34
  [<b0238b71>] padzero+0x4d/0x58
 ==================================================================

Use __memset in __xtensa_clear_user to avoid that.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  • Loading branch information
Max Filippov committed Dec 17, 2017
1 parent c633544 commit e0baa01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/xtensa/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
static inline unsigned long
__xtensa_clear_user(void *addr, unsigned long size)
{
if ( ! memset(addr, 0, size) )
if (!__memset(addr, 0, size))
return size;
return 0;
}
Expand Down

0 comments on commit e0baa01

Please sign in to comment.