OT: kernel oops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok guys, I have one more question on this assignment :-)

I successfully read in the data using copy_from_user and then I did some mangling of the data which I verified worked properly.

Now I want to put it back into user space, so I use:

If (copy_to_user(buf, tbuf2, count))

Buf is defined in the parameter list of my function as:
Const char __user * buf
Tbuf2 is defined as 
Char *tbuf;
And count is just an int.

I get a compile time error:
/home/seed/hw5/hookme.c:128: warning: passing argument 1 of ???copy_to_user??? discards qualifiers from pointer target type

Any good ideas on why this occurring and how I can fix it?

Thanks in advance for any help!
-----Original Message-----
From: Jason White [mailto:jason@xxxxxxxxxxxx] 
Sent: Thursday, July 18, 2013 4:43 PM
To: speakup at linux-speakup.org
Subject: Re: OT: kernel oops

Chris Brannon <chris at the-brannons.com> wrote:
> Don Raikes <don.raikes at oracle.com> writes:
> 
> > The section of code that is having problems looks like this:
> *SNIP*
> > if (copy_from_user(&tbuf, buf, count))
> 
> This line is your problem.  You are passing a 
> pointer-to-pointer-to-character (char **) as the first argument to 
> copy_from_user, but you should be passing char * instead.  So ditch 
> the ampersand, and all will be right with the world!
> I could give you a thorough explanation of why this is failing, if you 
> like, but to make a long story short, this line of code is smashing 
> the stack!

In other words, you're passing it the address of the pointer to the buffer, rather than the pointer itself, which holds the address of the buffer.

_______________________________________________
Speakup mailing list
Speakup at linux-speakup.org
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup


[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux