Access_ OK (), _ copy_to_user ()

Source: Internet
Author: User
1. access_ OK
 
Static inline int access_ OK (INT type, const void * ADDR, unsigned Long SIZE ){
 
Extern unsigned long memory_start, memory_end; unsigned long Val = (unsigned long) ADDR; Return (Val> = memory_start) & (Val + size) memory_end ));} its function is to check whether the user space is valid. Its first parameter: type, which has two types: verify_read and verify_write. The former is readable and the latter can be written. Note: if the flag is writeable (verify_write), it must be readable! Because the writable superset is readable (% verify_write is a superset of % verify_read ).
 
The check process is as follows: ADDR is the starting address and size is the size to be copied. From ADDR to ADDR + size is the space to be checked, if its range is between memory_start and memory_end.
 
 
 
 
 2. _ copy_to_user () Static inline _ kernel_size_t _ copy_to_user (void _ User * To, const void * From, __kernel_size_t N) {return _ copy_user (void _ force *) to, from, n) ;}haha, another function __copy_user (), this function is actually doing underlying replication. Http://lxr.linux.no/linux/arch/cris/arch-v10/lib/usercopy.c#L34 to continue in-depth 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.