Skip to content

Commit 38696e3

Browse files
committed
Merge tag 'xtensa-20200603' of git://github.com/jcmvbkbc/linux-xtensa
Pull Xtensa updates from Max Filippov: - fix __user annotations in asm/uaccess.h - fix comments in entry.S * tag 'xtensa-20200603' of git://github.com/jcmvbkbc/linux-xtensa: xtensa: Fix spelling/grammar in comment xtensa: add missing __user annotations to asm/uaccess.h xtensa: fix error paths in __get_user_{check,size} xtensa: fix type conversion in __get_user_size xtensa: add missing __user annotations to __{get,put}_user_check
2 parents 44e40e9 + 3ead2f9 commit 38696e3

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

arch/xtensa/include/asm/uaccess.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ extern long __put_user_bad(void);
8484
#define __put_user_check(x, ptr, size) \
8585
({ \
8686
long __pu_err = -EFAULT; \
87-
__typeof__(*(ptr)) *__pu_addr = (ptr); \
87+
__typeof__(*(ptr)) __user *__pu_addr = (ptr); \
8888
if (access_ok(__pu_addr, size)) \
8989
__put_user_size((x), __pu_addr, (size), __pu_err); \
9090
__pu_err; \
@@ -180,11 +180,11 @@ __asm__ __volatile__( \
180180
#define __get_user_check(x, ptr, size) \
181181
({ \
182182
long __gu_err = -EFAULT; \
183-
const __typeof__(*(ptr)) *__gu_addr = (ptr); \
183+
const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
184184
if (access_ok(__gu_addr, size)) \
185185
__get_user_size((x), __gu_addr, (size), __gu_err); \
186186
else \
187-
(x) = 0; \
187+
(x) = (__typeof__(*(ptr)))0; \
188188
__gu_err; \
189189
})
190190

@@ -202,13 +202,15 @@ do { \
202202
u64 __x; \
203203
if (unlikely(__copy_from_user(&__x, ptr, 8))) { \
204204
retval = -EFAULT; \
205-
(x) = 0; \
205+
(x) = (__typeof__(*(ptr)))0; \
206206
} else { \
207-
(x) = *(__force __typeof__((ptr)))&__x; \
207+
(x) = *(__force __typeof__(*(ptr)) *)&__x; \
208208
} \
209209
break; \
210210
} \
211-
default: (x) = 0; __get_user_bad(); \
211+
default: \
212+
(x) = (__typeof__(*(ptr)))0; \
213+
__get_user_bad(); \
212214
} \
213215
} while (0)
214216

@@ -270,15 +272,15 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
270272
*/
271273

272274
static inline unsigned long
273-
__xtensa_clear_user(void *addr, unsigned long size)
275+
__xtensa_clear_user(void __user *addr, unsigned long size)
274276
{
275-
if (!__memset(addr, 0, size))
277+
if (!__memset((void __force *)addr, 0, size))
276278
return size;
277279
return 0;
278280
}
279281

280282
static inline unsigned long
281-
clear_user(void *addr, unsigned long size)
283+
clear_user(void __user *addr, unsigned long size)
282284
{
283285
if (access_ok(addr, size))
284286
return __xtensa_clear_user(addr, size);
@@ -290,10 +292,10 @@ clear_user(void *addr, unsigned long size)
290292

291293
#ifndef CONFIG_GENERIC_STRNCPY_FROM_USER
292294

293-
extern long __strncpy_user(char *, const char *, long);
295+
extern long __strncpy_user(char *dst, const char __user *src, long count);
294296

295297
static inline long
296-
strncpy_from_user(char *dst, const char *src, long count)
298+
strncpy_from_user(char *dst, const char __user *src, long count)
297299
{
298300
if (access_ok(src, 1))
299301
return __strncpy_user(dst, src, count);
@@ -306,13 +308,11 @@ long strncpy_from_user(char *dst, const char *src, long count);
306308
/*
307309
* Return the size of a string (including the ending 0!)
308310
*/
309-
extern long __strnlen_user(const char *, long);
311+
extern long __strnlen_user(const char __user *str, long len);
310312

311-
static inline long strnlen_user(const char *str, long len)
313+
static inline long strnlen_user(const char __user *str, long len)
312314
{
313-
unsigned long top = __kernel_ok ? ~0UL : TASK_SIZE - 1;
314-
315-
if ((unsigned long)str > top)
315+
if (!access_ok(str, 1))
316316
return 0;
317317
return __strnlen_user(str, len);
318318
}

arch/xtensa/kernel/entry.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,14 +959,14 @@ ENDPROC(unrecoverable_exception)
959959
* of the proper size instead.
960960
*
961961
* This algorithm simply backs out the register changes started by the user
962-
* excpetion handler, makes it appear that we have started a window underflow
962+
* exception handler, makes it appear that we have started a window underflow
963963
* by rotating the window back and then setting the old window base (OWB) in
964964
* the 'ps' register with the rolled back window base. The 'movsp' instruction
965965
* will be re-executed and this time since the next window frames is in the
966966
* active AR registers it won't cause an exception.
967967
*
968968
* If the WindowUnderflow code gets a TLB miss the page will get mapped
969-
* the the partial windeowUnderflow will be handeled in the double exception
969+
* the partial WindowUnderflow will be handled in the double exception
970970
* handler.
971971
*
972972
* Entry condition:

0 commit comments

Comments
 (0)