LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-06-2013, 11:38 AM   #1
nagarajuk
LQ Newbie
 
Registered: Jun 2013
Posts: 2

Rep: Reputation: Disabled
copy_to_user


Hi,

What is the difference between the copy_to_user/copy_from_user to memcpy?

Thanks,
raju
 
Old 06-06-2013, 01:33 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by nagarajuk View Post
Hi,
What is the difference between the copy_to_user/copy_from_user to memcpy?
Please try to research and look things up on your own. From a brief Google search:
http://www.gossamer-threads.com/list.../kernel/594886
http://wiki.answers.com/Q/Difference...cpy_and_memcpy

It comes down to 'safe' access to memory, thats what copy to usr/copy from user is. It does validation on user space pointers, which memcpy often doesn't do. Try memcpy in your code in place of copy to usr; it will work if your user space pointer is valid. But, if the user space address is swapped out...see what happens then....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
copy_to_user within module. maheshstms Linux - Kernel 5 02-11-2014 05:04 AM
problems with copy_to_user() leoremoto Linux - Kernel 8 07-20-2012 01:28 PM
copy_from_user and copy_to_user example krisonearth Programming 5 09-29-2009 05:08 PM
copy_to_user nili Linux - Kernel 8 05-20-2008 04:08 AM
Kernel Programming - copy_to_user jamie_barrow Programming 1 08-13-2006 09:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration