OT: kernel oops
Jason White
jason at jasonjgw.net
Thu Jul 18 21:34:18 EDT 2013
Don Raikes <don.raikes at oracle.com> wrote:
> If (copy_to_user(buf, tbuf2, count))
>
> Buf is defined in the parameter list of my function as:
> Const char __user * buf
It's also the destination of the copy, so it shouldn't be const. You're
declaring the buffer as const, then passing it to a function that will write
to it.
This is why the compiler complains that you're discarding the const qualifier
when you pass this parameter to the function.
Does that help?
It's probably best to remove the "const" from the declaration of buf.
Alternatively, you can use a cast expression in the call to copy_to_user, but
declaring a parameter as constant and then casting that away is not a good
practice in my personal view.
More information about the Speakup
mailing list