lkml.org 
[lkml]   [2019]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] xtensa: fix {get,put}_user() for 64bit values
On Thu, Oct 10, 2019 at 7:29 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
> Hmm... Looking at __get_user_size(), we have retval = 0; very early
> in it. So I wonder if it should simply be
> #define __get_user_size(x, ptr, size, retval) \
> do { \
> int __cb; \
> retval = 0; \
> switch (size) { \
> case 1: __get_user_asm(x, ptr, retval, 1, "l8ui", __cb); break;\
> case 2: __get_user_asm(x, ptr, retval, 2, "l16ui", __cb); break;\
> case 4: __get_user_asm(x, ptr, retval, 4, "l32i", __cb); break;\
> case 8: if (unlikely(__copy_from_user(&x, ptr, 8)) { \
> retval = -EFAULT; \
> x = 0; \
> } \
> break; \
> default: (x) = __get_user_bad(); \
> } \
> } while (0)
> so that 64bit case is closer to the others in that respect (i.e. zeroing
> done on failure and out of line). No?

Ok, I agree.
The intermediate __gu_val in __get_user_[no]check doesn't work well
with some data types used in the kernel, unfortunately. I'll post a series
with what's close to your initial patch on top of rearranged
__get_user_[no]check.

--
Thanks.
-- Max

\
 
 \ /
  Last update: 2019-10-11 05:38    [W:1.789 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site