Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 36215
b: refs/heads/master
c: 1b79e55
h: refs/heads/master
i:
  36213: 6dc8faf
  36211: 8234483
  36207: 4bd0908
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Sep 27, 2006
1 parent 48d9eee commit 50b8e89
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aafe6c2a2b6bce5a3a4913ce5c07e85ea143144d
refs/heads/master: 1b79e5513d52e8533a08af35a3595dad80c74d1f
22 changes: 22 additions & 0 deletions trunk/include/linux/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,26 @@ static inline unsigned long __copy_from_user_nocache(void *to,

#endif /* ARCH_HAS_NOCACHE_UACCESS */

/**
* probe_kernel_address(): safely attempt to read from a location
* @addr: address to read from - its type is type typeof(retval)*
* @retval: read into this variable
*
* Safely read from address @addr into variable @revtal. If a kernel fault
* happens, handle that and return -EFAULT.
* We ensure that the __get_user() is executed in atomic context so that
* do_page_fault() doesn't attempt to take mmap_sem. This makes
* probe_kernel_address() suitable for use within regions where the caller
* already holds mmap_sem, or other locks which nest inside mmap_sem.
*/
#define probe_kernel_address(addr, retval) \
({ \
long ret; \
\
inc_preempt_count(); \
ret = __get_user(retval, addr); \
dec_preempt_count(); \
ret; \
})

#endif /* __LINUX_UACCESS_H__ */

0 comments on commit 50b8e89

Please sign in to comment.