Re: Fwd: FW: [PATCH 18/31] nds32: Library functions

2017-11-17 Thread Al Viro
On Tue, Nov 14, 2017 at 12:47:04PM +0800, Vincent Chen wrote: > Thanks > So, I should keep the area that we've copied into instead of zeroing > the area even if unpredicted exception is happened. Right? Yes. Here's what's required: if raw_copy_{from,to}_user(from, to, size) returns n, we want

Fwd: FW: [PATCH 18/31] nds32: Library functions

2017-11-13 Thread Vincent Chen
>>On Wed, Nov 08, 2017 at 01:55:06PM +0800, Greentime Hu wrote: > >> +#define __range_ok(addr, size) (size <= get_fs() && addr <= (get_fs() >> +-size)) >> + >> +#define access_ok(type, addr, size) \ >> + __range_ok((unsigned long)addr, (unsigned long)size) > >> +#define __get_us

Re: [PATCH 18/31] nds32: Library functions

2017-11-08 Thread Al Viro
On Wed, Nov 08, 2017 at 01:55:06PM +0800, Greentime Hu wrote: > +#define __range_ok(addr, size) (size <= get_fs() && addr <= (get_fs() -size)) > + > +#define access_ok(type, addr, size) \ > + __range_ok((unsigned long)addr, (unsigned long)size) > +#define __get_user_x(__r2,__p

Re: [PATCH 18/31] nds32: Library functions

2017-11-08 Thread Arnd Bergmann
On Wed, Nov 8, 2017 at 6:55 AM, Greentime Hu wrote: > +#define get_user(x,p) \ > + ({ \ > + const register typeof(*(p)) __user *__p asm("$r0") = (p);\ > +

[PATCH 18/31] nds32: Library functions

2017-11-07 Thread Greentime Hu
From: Greentime Hu Signed-off-by: Vincent Chen Signed-off-by: Greentime Hu --- arch/nds32/include/asm/string.h | 30 +++ arch/nds32/include/asm/swab.h| 48 + arch/nds32/include/asm/uaccess.h | 385 ++ arch/nds32/kernel/nds32_ksyms.c | 54 +++