Find the answer to your Linux question:
Results 1 to 3 of 3
Hi,everyone I am newbie to linux kernel, I'm write ioctl function, the input argument is integer, kernel space need to use this integer argument within user space, should I to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    8

    a question about copy_from_user/copy_to_user


    Hi,everyone
    I am newbie to linux kernel, I'm write ioctl function, the input argument is integer, kernel space need to use this integer argument within user space, should I to use copy_from_user() function or directly to use it?

    When I can directly to use user space data in kernel space?

    Thanks!

    Ian

  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    You should use copy_from_user() because it performs some rudimentary checks on the address location of the data plus it guarantees a level compatibility but if thats not a concern you could pass a pointer to the data...Hope this helps Gerard4143

    Welcome to the forums

  3. #3
    Just Joined!
    Join Date
    Jan 2009
    Posts
    8
    Thank your help!

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •