uaccess.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  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. * Support macros for __get_user().
  104. *
  105. * Implementation note: The "case 8" logic of casting to the type of
  106. * the result of subtracting the value from itself is basically a way
  107. * of keeping all integer types the same, but casting any pointers to
  108. * ptrdiff_t, i.e. also an integer type. This way there are no
  109. * questionable casts seen by the compiler on an ILP32 platform.
  110. *
  111. * Note that __get_user() and __put_user() assume proper alignment.
  112. */
  113. #ifdef __LP64__
  114. #define _ASM_PTR ".quad"
  115. #define _ASM_ALIGN ".align 8"
  116. #else
  117. #define _ASM_PTR ".long"
  118. #define _ASM_ALIGN ".align 4"
  119. #endif
  120. #define __get_user_asm(OP, x, ptr, ret) \
  121. asm volatile("1: {" #OP " %1, %2; movei %0, 0 }\n" \
  122. ".pushsection .fixup,\"ax\"\n" \
  123. "0: { movei %1, 0; movei %0, %3 }\n" \
  124. "j 9f\n" \
  125. ".section __ex_table,\"a\"\n" \
  126. _ASM_ALIGN "\n" \
  127. _ASM_PTR " 1b, 0b\n" \
  128. ".popsection\n" \
  129. "9:" \
  130. : "=r" (ret), "=r" (x) \
  131. : "r" (ptr), "i" (-EFAULT))
  132. #ifdef __tilegx__
  133. #define __get_user_1(x, ptr, ret) __get_user_asm(ld1u, x, ptr, ret)
  134. #define __get_user_2(x, ptr, ret) __get_user_asm(ld2u, x, ptr, ret)
  135. #define __get_user_4(x, ptr, ret) __get_user_asm(ld4s, x, ptr, ret)
  136. #define __get_user_8(x, ptr, ret) __get_user_asm(ld, x, ptr, ret)
  137. #else
  138. #define __get_user_1(x, ptr, ret) __get_user_asm(lb_u, x, ptr, ret)
  139. #define __get_user_2(x, ptr, ret) __get_user_asm(lh_u, x, ptr, ret)
  140. #define __get_user_4(x, ptr, ret) __get_user_asm(lw, x, ptr, ret)
  141. #ifdef __LITTLE_ENDIAN
  142. #define __lo32(a, b) a
  143. #define __hi32(a, b) b
  144. #else
  145. #define __lo32(a, b) b
  146. #define __hi32(a, b) a
  147. #endif
  148. #define __get_user_8(x, ptr, ret) \
  149. ({ \
  150. unsigned int __a, __b; \
  151. asm volatile("1: { lw %1, %3; addi %2, %3, 4 }\n" \
  152. "2: { lw %2, %2; movei %0, 0 }\n" \
  153. ".pushsection .fixup,\"ax\"\n" \
  154. "0: { movei %1, 0; movei %2, 0 }\n" \
  155. "{ movei %0, %4; j 9f }\n" \
  156. ".section __ex_table,\"a\"\n" \
  157. ".align 4\n" \
  158. ".word 1b, 0b\n" \
  159. ".word 2b, 0b\n" \
  160. ".popsection\n" \
  161. "9:" \
  162. : "=r" (ret), "=r" (__a), "=&r" (__b) \
  163. : "r" (ptr), "i" (-EFAULT)); \
  164. (x) = (__typeof(x))(__typeof((x)-(x))) \
  165. (((u64)__hi32(__a, __b) << 32) | \
  166. __lo32(__a, __b)); \
  167. })
  168. #endif
  169. extern int __get_user_bad(void)
  170. __attribute__((warning("sizeof __get_user argument not 1, 2, 4 or 8")));
  171. /**
  172. * __get_user: - Get a simple variable from user space, with less checking.
  173. * @x: Variable to store result.
  174. * @ptr: Source address, in user space.
  175. *
  176. * Context: User context only. This function may sleep.
  177. *
  178. * This macro copies a single simple variable from user space to kernel
  179. * space. It supports simple types like char and int, but not larger
  180. * data types like structures or arrays.
  181. *
  182. * @ptr must have pointer-to-simple-variable type, and the result of
  183. * dereferencing @ptr must be assignable to @x without a cast.
  184. *
  185. * Returns zero on success, or -EFAULT on error.
  186. * On error, the variable @x is set to zero.
  187. *
  188. * Caller must check the pointer with access_ok() before calling this
  189. * function.
  190. */
  191. #define __get_user(x, ptr) \
  192. ({ \
  193. int __ret; \
  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. __ret; \
  203. })
  204. /* Support macros for __put_user(). */
  205. #define __put_user_asm(OP, x, ptr, ret) \
  206. asm volatile("1: {" #OP " %1, %2; movei %0, 0 }\n" \
  207. ".pushsection .fixup,\"ax\"\n" \
  208. "0: { movei %0, %3; j 9f }\n" \
  209. ".section __ex_table,\"a\"\n" \
  210. _ASM_ALIGN "\n" \
  211. _ASM_PTR " 1b, 0b\n" \
  212. ".popsection\n" \
  213. "9:" \
  214. : "=r" (ret) \
  215. : "r" (ptr), "r" (x), "i" (-EFAULT))
  216. #ifdef __tilegx__
  217. #define __put_user_1(x, ptr, ret) __put_user_asm(st1, x, ptr, ret)
  218. #define __put_user_2(x, ptr, ret) __put_user_asm(st2, x, ptr, ret)
  219. #define __put_user_4(x, ptr, ret) __put_user_asm(st4, x, ptr, ret)
  220. #define __put_user_8(x, ptr, ret) __put_user_asm(st, x, ptr, ret)
  221. #else
  222. #define __put_user_1(x, ptr, ret) __put_user_asm(sb, x, ptr, ret)
  223. #define __put_user_2(x, ptr, ret) __put_user_asm(sh, x, ptr, ret)
  224. #define __put_user_4(x, ptr, ret) __put_user_asm(sw, x, ptr, ret)
  225. #define __put_user_8(x, ptr, ret) \
  226. ({ \
  227. u64 __x = (__typeof((x)-(x)))(x); \
  228. int __lo = (int) __x, __hi = (int) (__x >> 32); \
  229. asm volatile("1: { sw %1, %2; addi %0, %1, 4 }\n" \
  230. "2: { sw %0, %3; movei %0, 0 }\n" \
  231. ".pushsection .fixup,\"ax\"\n" \
  232. "0: { movei %0, %4; j 9f }\n" \
  233. ".section __ex_table,\"a\"\n" \
  234. ".align 4\n" \
  235. ".word 1b, 0b\n" \
  236. ".word 2b, 0b\n" \
  237. ".popsection\n" \
  238. "9:" \
  239. : "=&r" (ret) \
  240. : "r" (ptr), "r" (__lo32(__lo, __hi)), \
  241. "r" (__hi32(__lo, __hi)), "i" (-EFAULT)); \
  242. })
  243. #endif
  244. extern int __put_user_bad(void)
  245. __attribute__((warning("sizeof __put_user argument not 1, 2, 4 or 8")));
  246. /**
  247. * __put_user: - Write a simple value into user space, with less checking.
  248. * @x: Value to copy to user space.
  249. * @ptr: Destination address, in user space.
  250. *
  251. * Context: User context only. This function may sleep.
  252. *
  253. * This macro copies a single simple value from kernel space to user
  254. * space. It supports simple types like char and int, but not larger
  255. * data types like structures or arrays.
  256. *
  257. * @ptr must have pointer-to-simple-variable type, and @x must be assignable
  258. * to the result of dereferencing @ptr.
  259. *
  260. * Caller must check the pointer with access_ok() before calling this
  261. * function.
  262. *
  263. * Returns zero on success, or -EFAULT on error.
  264. */
  265. #define __put_user(x, ptr) \
  266. ({ \
  267. int __ret; \
  268. __chk_user_ptr(ptr); \
  269. switch (sizeof(*(ptr))) { \
  270. case 1: __put_user_1(x, ptr, __ret); break; \
  271. case 2: __put_user_2(x, ptr, __ret); break; \
  272. case 4: __put_user_4(x, ptr, __ret); break; \
  273. case 8: __put_user_8(x, ptr, __ret); break; \
  274. default: __ret = __put_user_bad(); break; \
  275. } \
  276. __ret; \
  277. })
  278. /*
  279. * The versions of get_user and put_user without initial underscores
  280. * check the address of their arguments to make sure they are not
  281. * in kernel space.
  282. */
  283. #define put_user(x, ptr) \
  284. ({ \
  285. __typeof__(*(ptr)) __user *__Pu_addr = (ptr); \
  286. access_ok(VERIFY_WRITE, (__Pu_addr), sizeof(*(__Pu_addr))) ? \
  287. __put_user((x), (__Pu_addr)) : \
  288. -EFAULT; \
  289. })
  290. #define get_user(x, ptr) \
  291. ({ \
  292. __typeof__(*(ptr)) const __user *__Gu_addr = (ptr); \
  293. access_ok(VERIFY_READ, (__Gu_addr), sizeof(*(__Gu_addr))) ? \
  294. __get_user((x), (__Gu_addr)) : \
  295. ((x) = 0, -EFAULT); \
  296. })
  297. /**
  298. * __copy_to_user() - copy data into user space, with less checking.
  299. * @to: Destination address, in user space.
  300. * @from: Source address, in kernel space.
  301. * @n: Number of bytes to copy.
  302. *
  303. * Context: User context only. This function may sleep.
  304. *
  305. * Copy data from kernel space to user space. Caller must check
  306. * the specified block with access_ok() before calling this function.
  307. *
  308. * Returns number of bytes that could not be copied.
  309. * On success, this will be zero.
  310. *
  311. * An alternate version - __copy_to_user_inatomic() - is designed
  312. * to be called from atomic context, typically bracketed by calls
  313. * to pagefault_disable() and pagefault_enable().
  314. */
  315. extern unsigned long __must_check __copy_to_user_inatomic(
  316. void __user *to, const void *from, unsigned long n);
  317. static inline unsigned long __must_check
  318. __copy_to_user(void __user *to, const void *from, unsigned long n)
  319. {
  320. might_fault();
  321. return __copy_to_user_inatomic(to, from, n);
  322. }
  323. static inline unsigned long __must_check
  324. copy_to_user(void __user *to, const void *from, unsigned long n)
  325. {
  326. if (access_ok(VERIFY_WRITE, to, n))
  327. n = __copy_to_user(to, from, n);
  328. return n;
  329. }
  330. /**
  331. * __copy_from_user() - copy data from user space, with less checking.
  332. * @to: Destination address, in kernel space.
  333. * @from: Source address, in user space.
  334. * @n: Number of bytes to copy.
  335. *
  336. * Context: User context only. This function may sleep.
  337. *
  338. * Copy data from user space to kernel space. Caller must check
  339. * the specified block with access_ok() before calling this function.
  340. *
  341. * Returns number of bytes that could not be copied.
  342. * On success, this will be zero.
  343. *
  344. * If some data could not be copied, this function will pad the copied
  345. * data to the requested size using zero bytes.
  346. *
  347. * An alternate version - __copy_from_user_inatomic() - is designed
  348. * to be called from atomic context, typically bracketed by calls
  349. * to pagefault_disable() and pagefault_enable(). This version
  350. * does *NOT* pad with zeros.
  351. */
  352. extern unsigned long __must_check __copy_from_user_inatomic(
  353. void *to, const void __user *from, unsigned long n);
  354. extern unsigned long __must_check __copy_from_user_zeroing(
  355. void *to, const void __user *from, unsigned long n);
  356. static inline unsigned long __must_check
  357. __copy_from_user(void *to, const void __user *from, unsigned long n)
  358. {
  359. might_fault();
  360. return __copy_from_user_zeroing(to, from, n);
  361. }
  362. static inline unsigned long __must_check
  363. _copy_from_user(void *to, const void __user *from, unsigned long n)
  364. {
  365. if (access_ok(VERIFY_READ, from, n))
  366. n = __copy_from_user(to, from, n);
  367. else
  368. memset(to, 0, n);
  369. return n;
  370. }
  371. #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
  372. /*
  373. * There are still unprovable places in the generic code as of 2.6.34, so this
  374. * option is not really compatible with -Werror, which is more useful in
  375. * general.
  376. */
  377. extern void copy_from_user_overflow(void)
  378. __compiletime_warning("copy_from_user() size is not provably correct");
  379. static inline unsigned long __must_check copy_from_user(void *to,
  380. const void __user *from,
  381. unsigned long n)
  382. {
  383. int sz = __compiletime_object_size(to);
  384. if (likely(sz == -1 || sz >= n))
  385. n = _copy_from_user(to, from, n);
  386. else
  387. copy_from_user_overflow();
  388. return n;
  389. }
  390. #else
  391. #define copy_from_user _copy_from_user
  392. #endif
  393. #ifdef __tilegx__
  394. /**
  395. * __copy_in_user() - copy data within user space, with less checking.
  396. * @to: Destination address, in user space.
  397. * @from: Source address, in user space.
  398. * @n: Number of bytes to copy.
  399. *
  400. * Context: User context only. This function may sleep.
  401. *
  402. * Copy data from user space to user space. Caller must check
  403. * the specified blocks with access_ok() before calling this function.
  404. *
  405. * Returns number of bytes that could not be copied.
  406. * On success, this will be zero.
  407. */
  408. extern unsigned long __copy_in_user_inatomic(
  409. void __user *to, const void __user *from, unsigned long n);
  410. static inline unsigned long __must_check
  411. __copy_in_user(void __user *to, const void __user *from, unsigned long n)
  412. {
  413. might_fault();
  414. return __copy_in_user_inatomic(to, from, n);
  415. }
  416. static inline unsigned long __must_check
  417. copy_in_user(void __user *to, const void __user *from, unsigned long n)
  418. {
  419. if (access_ok(VERIFY_WRITE, to, n) && access_ok(VERIFY_READ, from, n))
  420. n = __copy_in_user(to, from, n);
  421. return n;
  422. }
  423. #endif
  424. /**
  425. * strlen_user: - Get the size of a string in user space.
  426. * @str: The string to measure.
  427. *
  428. * Context: User context only. This function may sleep.
  429. *
  430. * Get the size of a NUL-terminated string in user space.
  431. *
  432. * Returns the size of the string INCLUDING the terminating NUL.
  433. * On exception, returns 0.
  434. *
  435. * If there is a limit on the length of a valid string, you may wish to
  436. * consider using strnlen_user() instead.
  437. */
  438. extern long strnlen_user_asm(const char __user *str, long n);
  439. static inline long __must_check strnlen_user(const char __user *str, long n)
  440. {
  441. might_fault();
  442. return strnlen_user_asm(str, n);
  443. }
  444. #define strlen_user(str) strnlen_user(str, LONG_MAX)
  445. /**
  446. * strncpy_from_user: - Copy a NUL terminated string from userspace, with less checking.
  447. * @dst: Destination address, in kernel space. This buffer must be at
  448. * least @count bytes long.
  449. * @src: Source address, in user space.
  450. * @count: Maximum number of bytes to copy, including the trailing NUL.
  451. *
  452. * Copies a NUL-terminated string from userspace to kernel space.
  453. * Caller must check the specified block with access_ok() before calling
  454. * this function.
  455. *
  456. * On success, returns the length of the string (not including the trailing
  457. * NUL).
  458. *
  459. * If access to userspace fails, returns -EFAULT (some data may have been
  460. * copied).
  461. *
  462. * If @count is smaller than the length of the string, copies @count bytes
  463. * and returns @count.
  464. */
  465. extern long strncpy_from_user_asm(char *dst, const char __user *src, long);
  466. static inline long __must_check __strncpy_from_user(
  467. char *dst, const char __user *src, long count)
  468. {
  469. might_fault();
  470. return strncpy_from_user_asm(dst, src, count);
  471. }
  472. static inline long __must_check strncpy_from_user(
  473. char *dst, const char __user *src, long count)
  474. {
  475. if (access_ok(VERIFY_READ, src, 1))
  476. return __strncpy_from_user(dst, src, count);
  477. return -EFAULT;
  478. }
  479. /**
  480. * clear_user: - Zero a block of memory in user space.
  481. * @mem: Destination address, in user space.
  482. * @len: Number of bytes to zero.
  483. *
  484. * Zero a block of memory in user space.
  485. *
  486. * Returns number of bytes that could not be cleared.
  487. * On success, this will be zero.
  488. */
  489. extern unsigned long clear_user_asm(void __user *mem, unsigned long len);
  490. static inline unsigned long __must_check __clear_user(
  491. void __user *mem, unsigned long len)
  492. {
  493. might_fault();
  494. return clear_user_asm(mem, len);
  495. }
  496. static inline unsigned long __must_check clear_user(
  497. void __user *mem, unsigned long len)
  498. {
  499. if (access_ok(VERIFY_WRITE, mem, len))
  500. return __clear_user(mem, len);
  501. return len;
  502. }
  503. /**
  504. * flush_user: - Flush a block of memory in user space from cache.
  505. * @mem: Destination address, in user space.
  506. * @len: Number of bytes to flush.
  507. *
  508. * Returns number of bytes that could not be flushed.
  509. * On success, this will be zero.
  510. */
  511. extern unsigned long flush_user_asm(void __user *mem, unsigned long len);
  512. static inline unsigned long __must_check __flush_user(
  513. void __user *mem, unsigned long len)
  514. {
  515. int retval;
  516. might_fault();
  517. retval = flush_user_asm(mem, len);
  518. mb_incoherent();
  519. return retval;
  520. }
  521. static inline unsigned long __must_check flush_user(
  522. void __user *mem, unsigned long len)
  523. {
  524. if (access_ok(VERIFY_WRITE, mem, len))
  525. return __flush_user(mem, len);
  526. return len;
  527. }
  528. /**
  529. * finv_user: - Flush-inval a block of memory in user space from cache.
  530. * @mem: Destination address, in user space.
  531. * @len: Number of bytes to invalidate.
  532. *
  533. * Returns number of bytes that could not be flush-invalidated.
  534. * On success, this will be zero.
  535. */
  536. extern unsigned long finv_user_asm(void __user *mem, unsigned long len);
  537. static inline unsigned long __must_check __finv_user(
  538. void __user *mem, unsigned long len)
  539. {
  540. int retval;
  541. might_fault();
  542. retval = finv_user_asm(mem, len);
  543. mb_incoherent();
  544. return retval;
  545. }
  546. static inline unsigned long __must_check finv_user(
  547. void __user *mem, unsigned long len)
  548. {
  549. if (access_ok(VERIFY_WRITE, mem, len))
  550. return __finv_user(mem, len);
  551. return len;
  552. }
  553. #endif /* _ASM_TILE_UACCESS_H */