[PATCH RFC v2 0/6] staging: comedi: fix user/kernel space access of cmd->chanlist

Ian Abbott abbotti at mev.co.uk
Tue Sep 18 19:26:59 UTC 2012


On 2012-09-18 20:12, Dan Carpenter wrote:
> This introduces some new Sparse warnings in the compat code.
>
>     CHECK   drivers/staging/comedi/comedi_compat32.c
> drivers/staging/comedi/comedi_compat32.c:212:16: warning: cast removes address space of expression
> drivers/staging/comedi/comedi_compat32.c:212:16: warning: cast removes address space of expression
> drivers/staging/comedi/comedi_compat32.c:212:16: warning: cast removes address space of expression
> drivers/staging/comedi/comedi_compat32.c:212:16: warning: cast removes address space of expression
>     CC [M]  drivers/staging/comedi/comedi_compat32.o
>
>     210          err |= __put_user(temp.uint, &cmd->stop_arg);
>     211          err |= __get_user(temp.uptr, &cmd32->chanlist);
>     212          err |= __put_user(compat_ptr(temp.uptr), &cmd->chanlist);
>     213          err |= __get_user(temp.uint, &cmd32->chanlist_len);
>     214          err |= __put_user(temp.uint, &cmd->chanlist_len);
>     215          err |= __get_user(temp.uptr, &cmd32->data);
>     216          err |= __put_user(compat_ptr(temp.uptr), &cmd->data);
>     217          err |= __get_user(temp.uint, &cmd32->data_len);
>
> I'm not sure how to cast away the warnings...

You'd need a shadow of the `struct comedi_cmd` that tags the `chanlist` 
pointer tagged as `__user`.  I've been there!

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-



More information about the devel mailing list