uaccess.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. /*
  2. * Copyright 2010 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. #ifndef _ASM_TILE_UACCESS_H
  15. #define _ASM_TILE_UACCESS_H
  16. /*
  17. * User space memory access functions
  18. */
  19. #include <linux/sched.h>
  20. #include <linux/mm.h>
  21. #include <asm-generic/uaccess-unaligned.h>
  22. #include <asm/processor.h>
  23. #include <asm/page.h>
  24. #define VERIFY_READ 0
  25. #define VERIFY_WRITE 1
  26. /*
  27. * The fs value determines whether argument validity checking should be
  28. * performed or not. If get_fs() == USER_DS, checking is performed, with
  29. * get_fs() == KERNEL_DS, checking is bypassed.
  30. *
  31. * For historical reasons, these macros are grossly misnamed.
  32. */
  33. #define MAKE_MM_SEG(a) ((mm_segment_t) { (a) })
  34. #define KERNEL_DS MAKE_MM_SEG(-1UL)
  35. #define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
  36. #define get_ds() (KERNEL_DS)
  37. #define get_fs() (current_thread_info()->addr_limit)
  38. #define set_fs(x) (current_thread_info()->addr_limit = (x))
  39. #define segment_eq(a, b) ((a).seg == (b).seg)
  40. #ifndef __tilegx__
  41. /*
  42. * We could allow mapping all 16 MB at 0xfc000000, but we set up a
  43. * special hack in arch_setup_additional_pages() to auto-create a mapping
  44. * for the first 16 KB, and it would seem strange to have different
  45. * user-accessible semantics for memory at 0xfc000000 and above 0xfc004000.
  46. */
  47. static inline int is_arch_mappable_range(unsigned long addr,
  48. unsigned long size)
  49. {
  50. return (addr >= MEM_USER_INTRPT &&
  51. addr < (MEM_USER_INTRPT + INTRPT_SIZE) &&
  52. size <= (MEM_USER_INTRPT + INTRPT_SIZE) - addr);
  53. }
  54. #define is_arch_mappable_range is_arch_mappable_range
  55. #else
  56. #define is_arch_mappable_range(addr, size) 0
  57. #endif
  58. /*
  59. * Test whether a block of memory is a valid user space address.
  60. * Returns 0 if the range is valid, nonzero otherwise.
  61. */
  62. int __range_ok(unsigned long addr, unsigned long size);
  63. /**
  64. * access_ok: - Checks if a user space pointer is valid
  65. * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
  66. * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe
  67. * to write to a block, it is always safe to read from it.
  68. * @addr: User space pointer to start of block to check
  69. * @size: Size of block to check
  70. *
  71. * Context: User context only. This function may sleep.
  72. *
  73. * Checks if a pointer to a block of memory in user space is valid.
  74. *
  75. * Returns true (nonzero) if the memory block may be valid, false (zero)
  76. * if it is definitely invalid.
  77. *
  78. * Note that, depending on architecture, this function probably just
  79. * checks that the pointer is in the user space range - after calling
  80. * this function, memory access functions may still return -EFAULT.
  81. */
  82. #define access_ok(type, addr, size) ({ \
  83. __chk_user_ptr(addr); \
  84. likely(__range_ok((unsigned long)(addr), (size)) == 0); \
  85. })
  86. /*
  87. * The exception table consists of pairs of addresses: the first is the
  88. * address of an instruction that is allowed to fault, and the second is
  89. * the address at which the program should continue. No registers are
  90. * modified, so it is entirely up to the continuation code to figure out
  91. * what to do.
  92. *
  93. * All the routines below use bits of fixup code that are out of line
  94. * with the main instruction path. This means when everything is well,
  95. * we don't even have to jump over them. Further, they do not intrude
  96. * on our cache or tlb entries.
  97. */
  98. struct exception_table_entry {
  99. unsigned long insn, fixup;
  100. };
  101. extern int fixup_exception(struct pt_regs *regs);
  102. /*
  103. * This is a type: either unsigned long, if the argument fits into
  104. * that type, or otherwise unsigned long long.
  105. */
  106. #define __inttype(x) \
  107. __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
  108. /*
  109. * Support macros for __get_user().
  110. * Note that __get_user() and __put_user() assume proper alignment.
  111. */
  112. #ifdef __LP64__
  113. #define _ASM_PTR ".quad"
  114. #define _ASM_ALIGN ".align 8"
  115. #else
  116. #define _ASM_PTR ".long"
  117. #define _ASM_ALIGN ".align 4"
  118. #endif
  119. #define __get_user_asm(OP, x, ptr, ret) \
  120. asm volatile("1: {" #OP " %1, %2; movei %0, 0 }\n" \
  121. ".pushsection .fixup,\"ax\"\n" \
  122. "0: { movei %1, 0; movei %0, %3 }\n" \
  123. "j 9f\n" \
  124. ".section __ex_table,\"a\"\n" \
  125. _ASM_ALIGN "\n" \
  126. _ASM_PTR " 1b, 0b\n" \
  127. ".popsection\n" \
  128. "9:" \
  129. : "=r" (ret), "=r" (x) \
  130. : "r" (ptr), "i" (-EFAULT))
  131. #ifdef __tilegx__
  132. #define __get_user_1(x, ptr, ret) __get_user_asm(ld1u, x, ptr, ret)
  133. #define __get_user_2(x, ptr, ret) __get_user_asm(ld2u, x, ptr, ret)
  134. #define __get_user_4(x, ptr, ret) __get_user_asm(ld4s, x, ptr, ret)
  135. #define __get_user_8(x, ptr, ret) __get_user_asm(ld, x, ptr, ret)
  136. #else
  137. #define __get_user_1(x, ptr, ret) __get_user_asm(lb_u, x, ptr, ret)
  138. #define __get_user_2(x, ptr, ret) __get_user_asm(lh_u, x, ptr, ret)
  139. #define __get_user_4(x, ptr, ret) __get_user_asm(lw, x, ptr, ret)
  140. #ifdef __LITTLE_ENDIAN
  141. #define __lo32(a, b) a
  142. #define __hi32(a, b) b
  143. #else
  144. #define __lo32(a, b) b
  145. #define __hi32(a, b) a
  146. #endif
  147. #define __get_user_8(x, ptr, ret) \
  148. ({ \
  149. unsigned int __a, __b; \
  150. asm volatile("1: { lw %1, %3; addi %2, %3, 4 }\n" \
  151. "2: { lw %2, %2; movei %0, 0 }\n" \
  152. ".pushsection .fixup,\"ax\"\n" \
  153. "0: { movei %1, 0; movei %2, 0 }\n" \
  154. "{ movei %0, %4; j 9f }\n" \
  155. ".section __ex_table,\"a\"\n" \
  156. ".align 4\n" \
  157. ".word 1b, 0b\n" \
  158. ".word 2b, 0b\n" \
  159. ".popsection\n" \
  160. "9:" \
  161. : "=r" (ret), "=r" (__a), "=&r" (__b) \
  162. : "r" (ptr), "i" (-EFAULT)); \
  163. (x) = (__force __typeof(x))(__inttype(x)) \
  164. (((u64)__hi32(__a, __b) << 32) | \
  165. __lo32(__a, __b)); \
  166. })
  167. #endif
  168. extern int __get_user_bad(void)
  169. __attribute__((warning("sizeof __get_user argument not 1, 2, 4 or 8")));
  170. /**
  171. * __get_user: - Get a simple variable from user space, with less checking.
  172. * @x: Variable to store result.
  173. * @ptr: Source address, in user space.
  174. *
  175. * Context: User context only. This function may sleep.
  176. *
  177. * This macro copies a single simple variable from user space to kernel
  178. * space. It supports simple types like char and int, but not larger
  179. * data types like structures or arrays.
  180. *
  181. * @ptr must have pointer-to-simple-variable type, and the result of
  182. * dereferencing @ptr must be assignable to @x without a cast.
  183. *
  184. * Returns zero on success, or -EFAULT on error.
  185. * On error, the variable @x is set to zero.
  186. *
  187. * Caller must check the pointer with access_ok() before calling this
  188. * function.
  189. */
  190. #define __get_user(x, ptr) \
  191. ({ \
  192. int __ret; \
  193. typeof(x) _x; \
  194. __chk_user_ptr(ptr); \
  195. switch (sizeof(*(ptr))) { \
  196. case 1: __get_user_1(_x, ptr, __ret); break; \
  197. case 2: __get_user_2(_x, ptr, __ret); break; \
  198. case 4: __get_user_4(_x, ptr, __ret); break; \
  199. case 8: __get_user_8(_x, ptr, __ret); break; \
  200. default: __ret = __get_user_bad(); break; \
  201. } \
  202. (x) = (typeof(*(ptr))) _x; \
  203. __ret; \
  204. })
  205. /* Support macros for __put_user(). */
  206. #define __put_user_asm(OP, x, ptr, ret) \
  207. asm volatile("1: {" #OP " %1, %2; movei %0, 0 }\n" \
  208. ".pushsection .fixup,\"ax\"\n" \
  209. "0: { movei %0, %3; j 9f }\n" \
  210. ".section __ex_table,\"a\"\n" \
  211. _ASM_ALIGN "\n" \
  212. _ASM_PTR " 1b, 0b\n" \
  213. ".popsection\n" \
  214. "9:" \
  215. : "=r" (ret) \
  216. : "r" (ptr), "r" (x), "i" (-EFAULT))
  217. #ifdef __tilegx__
  218. #define __put_user_1(x, ptr, ret) __put_user_asm(st1, x, ptr, ret)
  219. #define __put_user_2(x, ptr, ret) __put_user_asm(st2, x, ptr, ret)
  220. #define __put_user_4(x, ptr, ret) __put_user_asm(st4, x, ptr, ret)
  221. #define __put_user_8(x, ptr, ret) __put_user_asm(st, x, ptr, ret)
  222. #else
  223. #define __put_user_1(x, ptr, ret) __put_user_asm(sb, x, ptr, ret)
  224. #define __put_user_2(x, ptr, ret) __put_user_asm(sh, x, ptr, ret)
  225. #define __put_user_4(x, ptr, ret) __put_user_asm(sw, x, ptr, ret)
  226. #define __put_user_8(x, ptr, ret) \
  227. ({ \
  228. u64 __x = (__force __inttype(x))(x); \
  229. int __lo = (int) __x, __hi = (int) (__x >> 32); \
  230. asm volatile("1: { sw %1, %2; addi %0, %1, 4 }\n" \
  231. "2: { sw %0, %3; movei %0, 0 }\n" \
  232. ".pushsection .fixup,\"ax\"\n" \
  233. "0: { movei %0, %4; j 9f }\n" \
  234. ".section __ex_table,\"a\"\n" \
  235. ".align 4\n" \
  236. ".word 1b, 0b\n" \
  237. ".word 2b, 0b\n" \
  238. ".popsection\n" \
  239. "9:" \
  240. : "=&r" (ret) \
  241. : "r" (ptr), "r" (__lo32(__lo, __hi)), \
  242. "r" (__hi32(__lo, __hi)), "i" (-EFAULT)); \
  243. })
  244. #endif
  245. extern int __put_user_bad(void)
  246. __attribute__((warning("sizeof __put_user argument not 1, 2, 4 or 8")));
  247. /**
  248. * __put_user: - Write a simple value into user space, with less checking.
  249. * @x: Value to copy to user space.
  250. * @ptr: Destination address, in user space.
  251. *
  252. * Context: User context only. This function may sleep.
  253. *
  254. * This macro copies a single simple value from kernel space to user
  255. * space. It supports simple types like char and int, but not larger
  256. * data types like structures or arrays.
  257. *
  258. * @ptr must have pointer-to-simple-variable type, and @x must be assignable
  259. * to the result of dereferencing @ptr.
  260. *
  261. * Caller must check the pointer with access_ok() before calling this
  262. * function.
  263. *
  264. * Returns zero on success, or -EFAULT on error.
  265. */
  266. #define __put_user(x, ptr) \
  267. ({ \
  268. int __ret; \
  269. typeof(*(ptr)) _x = (x); \
  270. __chk_user_ptr(ptr); \
  271. switch (sizeof(*(ptr))) { \
  272. case 1: __put_user_1(_x, ptr, __ret); break; \
  273. case 2: __put_user_2(_x, ptr, __ret); break; \
  274. case 4: __put_user_4(_x, ptr, __ret); break; \
  275. case 8: __put_user_8(_x, ptr, __ret); break; \
  276. default: __ret = __put_user_bad(); break; \
  277. } \
  278. __ret; \
  279. })
  280. /*
  281. * The versions of get_user and put_user without initial underscores
  282. * check the address of their arguments to make sure they are not
  283. * in kernel space.
  284. */
  285. #define put_user(x, ptr) \
  286. ({ \
  287. __typeof__(*(ptr)) __user *__Pu_addr = (ptr); \
  288. access_ok(VERIFY_WRITE, (__Pu_addr), sizeof(*(__Pu_addr))) ? \
  289. __put_user((x), (__Pu_addr)) : \
  290. -EFAULT; \
  291. })
  292. #define get_user(x, ptr) \
  293. ({ \
  294. __typeof__(*(ptr)) const __user *__Gu_addr = (ptr); \
  295. access_ok(VERIFY_READ, (__Gu_addr), sizeof(*(__Gu_addr))) ? \
  296. __get_user((x), (__Gu_addr)) : \
  297. ((x) = 0, -EFAULT); \
  298. })
  299. /**
  300. * __copy_to_user() - copy data into user space, with less checking.
  301. * @to: Destination address, in user space.
  302. * @from: Source address, in kernel space.
  303. * @n: Number of bytes to copy.
  304. *
  305. * Context: User context only. This function may sleep.
  306. *
  307. * Copy data from kernel space to user space. Caller must check
  308. * the specified block with access_ok() before calling this function.
  309. *
  310. * Returns number of bytes that could not be copied.
  311. * On success, this will be zero.
  312. *
  313. * An alternate version - __copy_to_user_inatomic() - is designed
  314. * to be called from atomic context, typically bracketed by calls
  315. * to pagefault_disable() and pagefault_enable().
  316. */
  317. extern unsigned long __must_check __copy_to_user_inatomic(
  318. void __user *to, const void *from, unsigned long n);
  319. static inline unsigned long __must_check
  320. __copy_to_user(void __user *to, const void *from, unsigned long n)
  321. {
  322. might_fault();
  323. return __copy_to_user_inatomic(to, from, n);
  324. }
  325. static inline unsigned long __must_check
  326. copy_to_user(void __user *to, const void *from, unsigned long n)
  327. {
  328. if (access_ok(VERIFY_WRITE, to, n))
  329. n = __copy_to_user(to, from, n);
  330. return n;
  331. }
  332. /**
  333. * __copy_from_user() - copy data from user space, with less checking.
  334. * @to: Destination address, in kernel space.
  335. * @from: Source address, in user space.
  336. * @n: Number of bytes to copy.
  337. *
  338. * Context: User context only. This function may sleep.
  339. *
  340. * Copy data from user space to kernel space. Caller must check
  341. * the specified block with access_ok() before calling this function.
  342. *
  343. * Returns number of bytes that could not be copied.
  344. * On success, this will be zero.
  345. *
  346. * If some data could not be copied, this function will pad the copied
  347. * data to the requested size using zero bytes.
  348. *
  349. * An alternate version - __copy_from_user_inatomic() - is designed
  350. * to be called from atomic context, typically bracketed by calls
  351. * to pagefault_disable() and pagefault_enable(). This version
  352. * does *NOT* pad with zeros.
  353. */
  354. extern unsigned long __must_check __copy_from_user_inatomic(
  355. void *to, const void __user *from, unsigned long n);
  356. extern unsigned long __must_check __copy_from_user_zeroing(
  357. void *to, const void __user *from, unsigned long n);
  358. static inline unsigned long __must_check
  359. __copy_from_user(void *to, const void __user *from, unsigned long n)
  360. {
  361. might_fault();
  362. return __copy_from_user_zeroing(to, from, n);
  363. }
  364. static inline unsigned long __must_check
  365. _copy_from_user(void *to, const void __user *from, unsigned long n)
  366. {
  367. if (access_ok(VERIFY_READ, from, n))
  368. n = __copy_from_user(to, from, n);
  369. else
  370. memset(to, 0, n);
  371. return n;
  372. }
  373. #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
  374. /*
  375. * There are still unprovable places in the generic code as of 2.6.34, so this
  376. * option is not really compatible with -Werror, which is more useful in
  377. * general.
  378. */
  379. extern void copy_from_user_overflow(void)
  380. __compiletime_warning("copy_from_user() size is not provably correct");
  381. static inline unsigned long __must_check copy_from_user(void *to,
  382. const void __user *from,
  383. unsigned long n)
  384. {
  385. int sz = __compiletime_object_size(to);
  386. if (likely(sz == -1 || sz >= n))
  387. n = _copy_from_user(to, from, n);
  388. else
  389. copy_from_user_overflow();
  390. return n;
  391. }
  392. #else
  393. #define copy_from_user _copy_from_user
  394. #endif
  395. #ifdef __tilegx__
  396. /**
  397. * __copy_in_user() - copy data within user space, with less checking.
  398. * @to: Destination address, in user space.
  399. * @from: Source address, in user space.
  400. * @n: Number of bytes to copy.
  401. *
  402. * Context: User context only. This function may sleep.
  403. *
  404. * Copy data from user space to user space. Caller must check
  405. * the specified blocks with access_ok() before calling this function.
  406. *
  407. * Returns number of bytes that could not be copied.
  408. * On success, this will be zero.
  409. */
  410. extern unsigned long __copy_in_user_inatomic(
  411. void __user *to, const void __user *from, unsigned long n);
  412. static inline unsigned long __must_check
  413. __copy_in_user(void __user *to, const void __user *from, unsigned long n)
  414. {
  415. might_fault();
  416. return __copy_in_user_inatomic(to, from, n);
  417. }
  418. static inline unsigned long __must_check
  419. copy_in_user(void __user *to, const void __user *from, unsigned long n)
  420. {
  421. if (access_ok(VERIFY_WRITE, to, n) && access_ok(VERIFY_READ, from, n))
  422. n = __copy_in_user(to, from, n);
  423. return n;
  424. }
  425. #endif
  426. /**
  427. * strlen_user: - Get the size of a string in user space.
  428. * @str: The string to measure.
  429. *
  430. * Context: User context only. This function may sleep.
  431. *
  432. * Get the size of a NUL-terminated string in user space.
  433. *
  434. * Returns the size of the string INCLUDING the terminating NUL.
  435. * On exception, returns 0.
  436. *
  437. * If there is a limit on the length of a valid string, you may wish to
  438. * consider using strnlen_user() instead.
  439. */
  440. extern long strnlen_user_asm(const char __user *str, long n);
  441. static inline long __must_check strnlen_user(const char __user *str, long n)
  442. {
  443. might_fault();
  444. return strnlen_user_asm(str, n);
  445. }
  446. #define strlen_user(str) strnlen_user(str, LONG_MAX)
  447. /**
  448. * strncpy_from_user: - Copy a NUL terminated string from userspace, with less checking.
  449. * @dst: Destination address, in kernel space. This buffer must be at
  450. * least @count bytes long.
  451. * @src: Source address, in user space.
  452. * @count: Maximum number of bytes to copy, including the trailing NUL.
  453. *
  454. * Copies a NUL-terminated string from userspace to kernel space.
  455. * Caller must check the specified block with access_ok() before calling
  456. * this function.
  457. *
  458. * On success, returns the length of the string (not including the trailing
  459. * NUL).
  460. *
  461. * If access to userspace fails, returns -EFAULT (some data may have been
  462. * copied).
  463. *
  464. * If @count is smaller than the length of the string, copies @count bytes
  465. * and returns @count.
  466. */
  467. extern long strncpy_from_user_asm(char *dst, const char __user *src, long);
  468. static inline long __must_check __strncpy_from_user(
  469. char *dst, const char __user *src, long count)
  470. {
  471. might_fault();
  472. return strncpy_from_user_asm(dst, src, count);
  473. }
  474. static inline long __must_check strncpy_from_user(
  475. char *dst, const char __user *src, long count)
  476. {
  477. if (access_ok(VERIFY_READ, src, 1))
  478. return __strncpy_from_user(dst, src, count);
  479. return -EFAULT;
  480. }
  481. /**
  482. * clear_user: - Zero a block of memory in user space.
  483. * @mem: Destination address, in user space.
  484. * @len: Number of bytes to zero.
  485. *
  486. * Zero a block of memory in user space.
  487. *
  488. * Returns number of bytes that could not be cleared.
  489. * On success, this will be zero.
  490. */
  491. extern unsigned long clear_user_asm(void __user *mem, unsigned long len);
  492. static inline unsigned long __must_check __clear_user(
  493. void __user *mem, unsigned long len)
  494. {
  495. might_fault();
  496. return clear_user_asm(mem, len);
  497. }
  498. static inline unsigned long __must_check clear_user(
  499. void __user *mem, unsigned long len)
  500. {
  501. if (access_ok(VERIFY_WRITE, mem, len))
  502. return __clear_user(mem, len);
  503. return len;
  504. }
  505. /**
  506. * flush_user: - Flush a block of memory in user space from cache.
  507. * @mem: Destination address, in user space.
  508. * @len: Number of bytes to flush.
  509. *
  510. * Returns number of bytes that could not be flushed.
  511. * On success, this will be zero.
  512. */
  513. extern unsigned long flush_user_asm(void __user *mem, unsigned long len);
  514. static inline unsigned long __must_check __flush_user(
  515. void __user *mem, unsigned long len)
  516. {
  517. int retval;
  518. might_fault();
  519. retval = flush_user_asm(mem, len);
  520. mb_incoherent();
  521. return retval;
  522. }
  523. static inline unsigned long __must_check flush_user(
  524. void __user *mem, unsigned long len)
  525. {
  526. if (access_ok(VERIFY_WRITE, mem, len))
  527. return __flush_user(mem, len);
  528. return len;
  529. }
  530. /**
  531. * finv_user: - Flush-inval a block of memory in user space from cache.
  532. * @mem: Destination address, in user space.
  533. * @len: Number of bytes to invalidate.
  534. *
  535. * Returns number of bytes that could not be flush-invalidated.
  536. * On success, this will be zero.
  537. */
  538. extern unsigned long finv_user_asm(void __user *mem, unsigned long len);
  539. static inline unsigned long __must_check __finv_user(
  540. void __user *mem, unsigned long len)
  541. {
  542. int retval;
  543. might_fault();
  544. retval = finv_user_asm(mem, len);
  545. mb_incoherent();
  546. return retval;
  547. }
  548. static inline unsigned long __must_check finv_user(
  549. void __user *mem, unsigned long len)
  550. {
  551. if (access_ok(VERIFY_WRITE, mem, len))
  552. return __finv_user(mem, len);
  553. return len;
  554. }
  555. #endif /* _ASM_TILE_UACCESS_H */