From: Don Raikes <don.raikes@oracle.com>
To: "Speakup is a screen review system for Linux."
<speakup@linux-speakup.org>
Subject: RE: OT: kernel oops
Date: Thu, 18 Jul 2013 17:46:49 -0700 (PDT) [thread overview]
Message-ID: <481c693b-a8bb-4700-baca-6e4a44fc23d6@default> (raw)
In-Reply-To: <20130718234302.GA7934@jdc.jasonjgw.net>
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@jasonjgw.net]
Sent: Thursday, July 18, 2013 4:43 PM
To: speakup@linux-speakup.org
Subject: Re: OT: kernel oops
Chris Brannon <chris@the-brannons.com> wrote:
> Don Raikes <don.raikes@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@linux-speakup.org
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup
next prev parent reply other threads:[~ UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
Don Raikes
` Jason White
` Chris Brannon
` Don Raikes
` Don Raikes
` Jason White
` Don Raikes [this message]
` Jason White
` Don Raikes
` Jason White
` Don Raikes
` Jason White
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=481c693b-a8bb-4700-baca-6e4a44fc23d6@default \
--to=don.raikes@oracle.com \
--cc=speakup@linux-speakup.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).