aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-15 21:02:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-15 21:02:02 -0500
commit1fa185ebcbcefdc5229c783450c9f0439a69f0c1 (patch)
tree78df9ad77a7ff85a8bbe5202b3d8b47f2764f783
parenta9724125ad014decf008d782e60447c811391326 (diff)
parent9987c19ed9a71693bf3efce2957666b2513a5252 (diff)
Merge tag 'cris-for-3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/jesper/cris
Pull CRIS changes from Jesper Nilsson. * tag 'cris-for-3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/jesper/cris: CRIS: Whitespace cleanup CRIS: macro whitespace fixes in uaccess.h CRIS: uaccess: fix sparse errors CRISv32: Remove unnecessary KERN_INFO from sync_serial CRIS: Fix missing NR_CPUS in menuconfig CRISv32: Avoid warning of unused variable CRIS: Avoid warning in cris mm/fault.c CRIS: Export csum_partial_copy_nocheck
-rw-r--r--arch/cris/Kconfig4
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c4
-rw-r--r--arch/cris/arch-v32/kernel/time.c4
-rw-r--r--arch/cris/include/asm/uaccess.h170
-rw-r--r--arch/cris/kernel/crisksyms.c1
-rw-r--r--arch/cris/mm/fault.c4
6 files changed, 111 insertions, 76 deletions
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 52731e221851..4a03911053ab 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -57,6 +57,10 @@ config HZ
57 int 57 int
58 default 100 58 default 100
59 59
60config NR_CPUS
61 int
62 default "1"
63
60source "init/Kconfig" 64source "init/Kconfig"
61 65
62source "kernel/Kconfig.freezer" 66source "kernel/Kconfig.freezer"
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index f772068d9e79..4dda9bd6b8fb 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -1286,7 +1286,7 @@ static void start_dma_out(struct sync_port *port, const char *data, int count)
1286 1286
1287 tr_cfg.tr_en = regk_sser_yes; 1287 tr_cfg.tr_en = regk_sser_yes;
1288 REG_WR(sser, port->regi_sser, rw_tr_cfg, tr_cfg); 1288 REG_WR(sser, port->regi_sser, rw_tr_cfg, tr_cfg);
1289 DEBUGTRDMA(pr_info(KERN_INFO "dma s\n");); 1289 DEBUGTRDMA(pr_info("dma s\n"););
1290 } else { 1290 } else {
1291 DMA_CONTINUE_DATA(port->regi_dmaout); 1291 DMA_CONTINUE_DATA(port->regi_dmaout);
1292 DEBUGTRDMA(pr_info("dma c\n");); 1292 DEBUGTRDMA(pr_info("dma c\n"););
@@ -1443,7 +1443,7 @@ static inline void handle_rx_packet(struct sync_port *port)
1443 reg_dma_rw_ack_intr ack_intr = { .data = regk_dma_yes }; 1443 reg_dma_rw_ack_intr ack_intr = { .data = regk_dma_yes };
1444 unsigned long flags; 1444 unsigned long flags;
1445 1445
1446 DEBUGRXINT(pr_info(KERN_INFO "!")); 1446 DEBUGRXINT(pr_info("!"));
1447 spin_lock_irqsave(&port->lock, flags); 1447 spin_lock_irqsave(&port->lock, flags);
1448 1448
1449 /* If we overrun the user experience is crap regardless if we 1449 /* If we overrun the user experience is crap regardless if we
diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c
index eb74dabbeb96..c17b01abdc3b 100644
--- a/arch/cris/arch-v32/kernel/time.c
+++ b/arch/cris/arch-v32/kernel/time.c
@@ -107,8 +107,10 @@ static short int watchdog_key = 42; /* arbitrary 7 bit number */
107 * is used though, so set this really low. */ 107 * is used though, so set this really low. */
108#define WATCHDOG_MIN_FREE_PAGES 8 108#define WATCHDOG_MIN_FREE_PAGES 8
109 109
110#if defined(CONFIG_ETRAX_WATCHDOG_NICE_DOGGY)
110/* for reliable NICE_DOGGY behaviour */ 111/* for reliable NICE_DOGGY behaviour */
111static int bite_in_progress; 112static int bite_in_progress;
113#endif
112 114
113void reset_watchdog(void) 115void reset_watchdog(void)
114{ 116{
@@ -155,7 +157,9 @@ void handle_watchdog_bite(struct pt_regs *regs)
155 157
156 nmi_enter(); 158 nmi_enter();
157 oops_in_progress = 1; 159 oops_in_progress = 1;
160#if defined(CONFIG_ETRAX_WATCHDOG_NICE_DOGGY)
158 bite_in_progress = 1; 161 bite_in_progress = 1;
162#endif
159 printk(KERN_WARNING "Watchdog bite\n"); 163 printk(KERN_WARNING "Watchdog bite\n");
160 164
161 /* Check if forced restart or unexpected watchdog */ 165 /* Check if forced restart or unexpected watchdog */
diff --git a/arch/cris/include/asm/uaccess.h b/arch/cris/include/asm/uaccess.h
index 914540801c5e..e3530d0f13ee 100644
--- a/arch/cris/include/asm/uaccess.h
+++ b/arch/cris/include/asm/uaccess.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * Authors: Bjorn Wesen (bjornw@axis.com) 2 * Authors: Bjorn Wesen (bjornw@axis.com)
3 * Hans-Peter Nilsson (hp@axis.com) 3 * Hans-Peter Nilsson (hp@axis.com)
4 */ 4 */
@@ -35,7 +35,7 @@
35#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) 35#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
36 36
37/* addr_limit is the maximum accessible address for the task. we misuse 37/* addr_limit is the maximum accessible address for the task. we misuse
38 * the KERNEL_DS and USER_DS values to both assign and compare the 38 * the KERNEL_DS and USER_DS values to both assign and compare the
39 * addr_limit values through the equally misnamed get/set_fs macros. 39 * addr_limit values through the equally misnamed get/set_fs macros.
40 * (see above) 40 * (see above)
41 */ 41 */
@@ -47,12 +47,13 @@
47#define get_fs() (current_thread_info()->addr_limit) 47#define get_fs() (current_thread_info()->addr_limit)
48#define set_fs(x) (current_thread_info()->addr_limit = (x)) 48#define set_fs(x) (current_thread_info()->addr_limit = (x))
49 49
50#define segment_eq(a,b) ((a).seg == (b).seg) 50#define segment_eq(a, b) ((a).seg == (b).seg)
51 51
52#define __kernel_ok (segment_eq(get_fs(), KERNEL_DS)) 52#define __kernel_ok (segment_eq(get_fs(), KERNEL_DS))
53#define __user_ok(addr,size) (((size) <= TASK_SIZE)&&((addr) <= TASK_SIZE-(size))) 53#define __user_ok(addr, size) \
54#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size))) 54 (((size) <= TASK_SIZE) && ((addr) <= TASK_SIZE-(size)))
55#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size)) 55#define __access_ok(addr, size) (__kernel_ok || __user_ok((addr), (size)))
56#define access_ok(type, addr, size) __access_ok((unsigned long)(addr), (size))
56 57
57#include <arch/uaccess.h> 58#include <arch/uaccess.h>
58 59
@@ -69,8 +70,7 @@
69 * on our cache or tlb entries. 70 * on our cache or tlb entries.
70 */ 71 */
71 72
72struct exception_table_entry 73struct exception_table_entry {
73{
74 unsigned long insn, fixup; 74 unsigned long insn, fixup;
75}; 75};
76 76
@@ -92,56 +92,74 @@ struct exception_table_entry
92 * CRIS, we can just do these as direct assignments. (Of course, the 92 * CRIS, we can just do these as direct assignments. (Of course, the
93 * exception handling means that it's no longer "just"...) 93 * exception handling means that it's no longer "just"...)
94 */ 94 */
95#define get_user(x,ptr) \ 95#define get_user(x, ptr) \
96 __get_user_check((x),(ptr),sizeof(*(ptr))) 96 __get_user_check((x), (ptr), sizeof(*(ptr)))
97#define put_user(x,ptr) \ 97#define put_user(x, ptr) \
98 __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) 98 __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
99 99
100#define __get_user(x,ptr) \ 100#define __get_user(x, ptr) \
101 __get_user_nocheck((x),(ptr),sizeof(*(ptr))) 101 __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
102#define __put_user(x,ptr) \ 102#define __put_user(x, ptr) \
103 __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) 103 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
104 104
105extern long __put_user_bad(void); 105extern long __put_user_bad(void);
106 106
107#define __put_user_size(x,ptr,size,retval) \ 107#define __put_user_size(x, ptr, size, retval) \
108do { \ 108do { \
109 retval = 0; \ 109 retval = 0; \
110 switch (size) { \ 110 switch (size) { \
111 case 1: __put_user_asm(x,ptr,retval,"move.b"); break; \ 111 case 1: \
112 case 2: __put_user_asm(x,ptr,retval,"move.w"); break; \ 112 __put_user_asm(x, ptr, retval, "move.b"); \
113 case 4: __put_user_asm(x,ptr,retval,"move.d"); break; \ 113 break; \
114 case 8: __put_user_asm_64(x,ptr,retval); break; \ 114 case 2: \
115 default: __put_user_bad(); \ 115 __put_user_asm(x, ptr, retval, "move.w"); \
116 } \ 116 break; \
117 case 4: \
118 __put_user_asm(x, ptr, retval, "move.d"); \
119 break; \
120 case 8: \
121 __put_user_asm_64(x, ptr, retval); \
122 break; \
123 default: \
124 __put_user_bad(); \
125 } \
117} while (0) 126} while (0)
118 127
119#define __get_user_size(x,ptr,size,retval) \ 128#define __get_user_size(x, ptr, size, retval) \
120do { \ 129do { \
121 retval = 0; \ 130 retval = 0; \
122 switch (size) { \ 131 switch (size) { \
123 case 1: __get_user_asm(x,ptr,retval,"move.b"); break; \ 132 case 1: \
124 case 2: __get_user_asm(x,ptr,retval,"move.w"); break; \ 133 __get_user_asm(x, ptr, retval, "move.b"); \
125 case 4: __get_user_asm(x,ptr,retval,"move.d"); break; \ 134 break; \
126 case 8: __get_user_asm_64(x,ptr,retval); break; \ 135 case 2: \
127 default: (x) = __get_user_bad(); \ 136 __get_user_asm(x, ptr, retval, "move.w"); \
128 } \ 137 break; \
138 case 4: \
139 __get_user_asm(x, ptr, retval, "move.d"); \
140 break; \
141 case 8: \
142 __get_user_asm_64(x, ptr, retval); \
143 break; \
144 default: \
145 (x) = __get_user_bad(); \
146 } \
129} while (0) 147} while (0)
130 148
131#define __put_user_nocheck(x,ptr,size) \ 149#define __put_user_nocheck(x, ptr, size) \
132({ \ 150({ \
133 long __pu_err; \ 151 long __pu_err; \
134 __put_user_size((x),(ptr),(size),__pu_err); \ 152 __put_user_size((x), (ptr), (size), __pu_err); \
135 __pu_err; \ 153 __pu_err; \
136}) 154})
137 155
138#define __put_user_check(x,ptr,size) \ 156#define __put_user_check(x, ptr, size) \
139({ \ 157({ \
140 long __pu_err = -EFAULT; \ 158 long __pu_err = -EFAULT; \
141 __typeof__(*(ptr)) *__pu_addr = (ptr); \ 159 __typeof__(*(ptr)) *__pu_addr = (ptr); \
142 if (access_ok(VERIFY_WRITE,__pu_addr,size)) \ 160 if (access_ok(VERIFY_WRITE, __pu_addr, size)) \
143 __put_user_size((x),__pu_addr,(size),__pu_err); \ 161 __put_user_size((x), __pu_addr, (size), __pu_err); \
144 __pu_err; \ 162 __pu_err; \
145}) 163})
146 164
147struct __large_struct { unsigned long buf[100]; }; 165struct __large_struct { unsigned long buf[100]; };
@@ -149,21 +167,21 @@ struct __large_struct { unsigned long buf[100]; };
149 167
150 168
151 169
152#define __get_user_nocheck(x,ptr,size) \ 170#define __get_user_nocheck(x, ptr, size) \
153({ \ 171({ \
154 long __gu_err, __gu_val; \ 172 long __gu_err, __gu_val; \
155 __get_user_size(__gu_val,(ptr),(size),__gu_err); \ 173 __get_user_size(__gu_val, (ptr), (size), __gu_err); \
156 (x) = (__typeof__(*(ptr)))__gu_val; \ 174 (x) = (__force __typeof__(*(ptr)))__gu_val; \
157 __gu_err; \ 175 __gu_err; \
158}) 176})
159 177
160#define __get_user_check(x,ptr,size) \ 178#define __get_user_check(x, ptr, size) \
161({ \ 179({ \
162 long __gu_err = -EFAULT, __gu_val = 0; \ 180 long __gu_err = -EFAULT, __gu_val = 0; \
163 const __typeof__(*(ptr)) *__gu_addr = (ptr); \ 181 const __typeof__(*(ptr)) *__gu_addr = (ptr); \
164 if (access_ok(VERIFY_READ,__gu_addr,size)) \ 182 if (access_ok(VERIFY_READ, __gu_addr, size)) \
165 __get_user_size(__gu_val,__gu_addr,(size),__gu_err); \ 183 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
166 (x) = (__typeof__(*(ptr)))__gu_val; \ 184 (x) = (__force __typeof__(*(ptr)))__gu_val; \
167 __gu_err; \ 185 __gu_err; \
168}) 186})
169 187
@@ -180,7 +198,7 @@ static inline unsigned long
180__generic_copy_to_user(void __user *to, const void *from, unsigned long n) 198__generic_copy_to_user(void __user *to, const void *from, unsigned long n)
181{ 199{
182 if (access_ok(VERIFY_WRITE, to, n)) 200 if (access_ok(VERIFY_WRITE, to, n))
183 return __copy_user(to,from,n); 201 return __copy_user(to, from, n);
184 return n; 202 return n;
185} 203}
186 204
@@ -188,7 +206,7 @@ static inline unsigned long
188__generic_copy_from_user(void *to, const void __user *from, unsigned long n) 206__generic_copy_from_user(void *to, const void __user *from, unsigned long n)
189{ 207{
190 if (access_ok(VERIFY_READ, from, n)) 208 if (access_ok(VERIFY_READ, from, n))
191 return __copy_user_zeroing(to,from,n); 209 return __copy_user_zeroing(to, from, n);
192 return n; 210 return n;
193} 211}
194 212
@@ -196,7 +214,7 @@ static inline unsigned long
196__generic_clear_user(void __user *to, unsigned long n) 214__generic_clear_user(void __user *to, unsigned long n)
197{ 215{
198 if (access_ok(VERIFY_WRITE, to, n)) 216 if (access_ok(VERIFY_WRITE, to, n))
199 return __do_clear_user(to,n); 217 return __do_clear_user(to, n);
200 return n; 218 return n;
201} 219}
202 220
@@ -210,6 +228,7 @@ static inline long
210strncpy_from_user(char *dst, const char __user *src, long count) 228strncpy_from_user(char *dst, const char __user *src, long count)
211{ 229{
212 long res = -EFAULT; 230 long res = -EFAULT;
231
213 if (access_ok(VERIFY_READ, src, 1)) 232 if (access_ok(VERIFY_READ, src, 1))
214 res = __do_strncpy_from_user(dst, src, count); 233 res = __do_strncpy_from_user(dst, src, count);
215 return res; 234 return res;
@@ -223,6 +242,7 @@ static inline unsigned long
223__constant_copy_from_user(void *to, const void __user *from, unsigned long n) 242__constant_copy_from_user(void *to, const void __user *from, unsigned long n)
224{ 243{
225 unsigned long ret = 0; 244 unsigned long ret = 0;
245
226 if (n == 0) 246 if (n == 0)
227 ; 247 ;
228 else if (n == 1) 248 else if (n == 1)
@@ -273,6 +293,7 @@ static inline unsigned long
273__constant_copy_to_user(void __user *to, const void *from, unsigned long n) 293__constant_copy_to_user(void __user *to, const void *from, unsigned long n)
274{ 294{
275 unsigned long ret = 0; 295 unsigned long ret = 0;
296
276 if (n == 0) 297 if (n == 0)
277 ; 298 ;
278 else if (n == 1) 299 else if (n == 1)
@@ -323,6 +344,7 @@ static inline unsigned long
323__constant_clear_user(void __user *to, unsigned long n) 344__constant_clear_user(void __user *to, unsigned long n)
324{ 345{
325 unsigned long ret = 0; 346 unsigned long ret = 0;
347
326 if (n == 0) 348 if (n == 0)
327 ; 349 ;
328 else if (n == 1) 350 else if (n == 1)
@@ -350,20 +372,20 @@ __constant_clear_user(void __user *to, unsigned long n)
350} 372}
351 373
352 374
353#define clear_user(to, n) \ 375#define clear_user(to, n) \
354(__builtin_constant_p(n) ? \ 376 (__builtin_constant_p(n) ? \
355 __constant_clear_user(to, n) : \ 377 __constant_clear_user(to, n) : \
356 __generic_clear_user(to, n)) 378 __generic_clear_user(to, n))
357 379
358#define copy_from_user(to, from, n) \ 380#define copy_from_user(to, from, n) \
359(__builtin_constant_p(n) ? \ 381 (__builtin_constant_p(n) ? \
360 __constant_copy_from_user(to, from, n) : \ 382 __constant_copy_from_user(to, from, n) : \
361 __generic_copy_from_user(to, from, n)) 383 __generic_copy_from_user(to, from, n))
362 384
363#define copy_to_user(to, from, n) \ 385#define copy_to_user(to, from, n) \
364(__builtin_constant_p(n) ? \ 386 (__builtin_constant_p(n) ? \
365 __constant_copy_to_user(to, from, n) : \ 387 __constant_copy_to_user(to, from, n) : \
366 __generic_copy_to_user(to, from, n)) 388 __generic_copy_to_user(to, from, n))
367 389
368/* We let the __ versions of copy_from/to_user inline, because they're often 390/* We let the __ versions of copy_from/to_user inline, because they're often
369 * used in fast paths and have only a small space overhead. 391 * used in fast paths and have only a small space overhead.
@@ -373,29 +395,31 @@ static inline unsigned long
373__generic_copy_from_user_nocheck(void *to, const void __user *from, 395__generic_copy_from_user_nocheck(void *to, const void __user *from,
374 unsigned long n) 396 unsigned long n)
375{ 397{
376 return __copy_user_zeroing(to,from,n); 398 return __copy_user_zeroing(to, from, n);
377} 399}
378 400
379static inline unsigned long 401static inline unsigned long
380__generic_copy_to_user_nocheck(void __user *to, const void *from, 402__generic_copy_to_user_nocheck(void __user *to, const void *from,
381 unsigned long n) 403 unsigned long n)
382{ 404{
383 return __copy_user(to,from,n); 405 return __copy_user(to, from, n);
384} 406}
385 407
386static inline unsigned long 408static inline unsigned long
387__generic_clear_user_nocheck(void __user *to, unsigned long n) 409__generic_clear_user_nocheck(void __user *to, unsigned long n)
388{ 410{
389 return __do_clear_user(to,n); 411 return __do_clear_user(to, n);
390} 412}
391 413
392/* without checking */ 414/* without checking */
393 415
394#define __copy_to_user(to,from,n) __generic_copy_to_user_nocheck((to),(from),(n)) 416#define __copy_to_user(to, from, n) \
395#define __copy_from_user(to,from,n) __generic_copy_from_user_nocheck((to),(from),(n)) 417 __generic_copy_to_user_nocheck((to), (from), (n))
418#define __copy_from_user(to, from, n) \
419 __generic_copy_from_user_nocheck((to), (from), (n))
396#define __copy_to_user_inatomic __copy_to_user 420#define __copy_to_user_inatomic __copy_to_user
397#define __copy_from_user_inatomic __copy_from_user 421#define __copy_from_user_inatomic __copy_from_user
398#define __clear_user(to,n) __generic_clear_user_nocheck((to),(n)) 422#define __clear_user(to, n) __generic_clear_user_nocheck((to), (n))
399 423
400#define strlen_user(str) strnlen_user((str), 0x7ffffffe) 424#define strlen_user(str) strnlen_user((str), 0x7ffffffe)
401 425
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
index 3908b942fd4c..e704f81f85cc 100644
--- a/arch/cris/kernel/crisksyms.c
+++ b/arch/cris/kernel/crisksyms.c
@@ -67,3 +67,4 @@ EXPORT_SYMBOL(schedule_usleep);
67#endif 67#endif
68EXPORT_SYMBOL(csum_partial); 68EXPORT_SYMBOL(csum_partial);
69EXPORT_SYMBOL(csum_partial_copy_from_user); 69EXPORT_SYMBOL(csum_partial_copy_from_user);
70EXPORT_SYMBOL(csum_partial_copy_nocheck);
diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c
index 2686a7aa8ec8..83f12f2ed9e3 100644
--- a/arch/cris/mm/fault.c
+++ b/arch/cris/mm/fault.c
@@ -219,6 +219,9 @@ retry:
219 /* User mode accesses just cause a SIGSEGV */ 219 /* User mode accesses just cause a SIGSEGV */
220 220
221 if (user_mode(regs)) { 221 if (user_mode(regs)) {
222#ifdef CONFIG_NO_SEGFAULT_TERMINATION
223 DECLARE_WAIT_QUEUE_HEAD(wq);
224#endif
222 printk(KERN_NOTICE "%s (pid %d) segfaults for page " 225 printk(KERN_NOTICE "%s (pid %d) segfaults for page "
223 "address %08lx at pc %08lx\n", 226 "address %08lx at pc %08lx\n",
224 tsk->comm, tsk->pid, 227 tsk->comm, tsk->pid,
@@ -229,7 +232,6 @@ retry:
229 show_registers(regs); 232 show_registers(regs);
230 233
231#ifdef CONFIG_NO_SEGFAULT_TERMINATION 234#ifdef CONFIG_NO_SEGFAULT_TERMINATION
232 DECLARE_WAIT_QUEUE_HEAD(wq);
233 wait_event_interruptible(wq, 0 == 1); 235 wait_event_interruptible(wq, 0 == 1);
234#else 236#else
235 info.si_signo = SIGSEGV; 237 info.si_signo = SIGSEGV;