OT: kernel oops

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

 



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.



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