[lkml]   [1997]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: get_user <-> scsi-idle
> hello all,
> i'm trying to hack scsi-idle to work with 2.1.22. between 2.0.x and 2.1.x,
> get_user changed at least from having one argument to having two arguments.
> the code segment, that works with 2.0.xx, is
> + if (get_user((long *) arg))
> + scsi_cmd[4] = 1;
> + else
> + scsi_cmd[4] = 0;
> +
> could someone recomend a rewrite for 2.1.x? also, a brief description of
> what is going on here would be appreciated. specifically, what is the
> difference in the functioning of the old and new get_user? the code is
> simply too deep for me to read.

"what is going on" with get_user() is described in kernel source
file: Documentation/exception.txt --- generally speaking it is
*DEEP* to read by anybody :-)
(It is also rather unlike the general language specific exception
handling in several programming languages -- these are HARDWARE
exceptions that are handled here in quite ingenious manner. )

The rewrite is:

int val, err;

if ((err = get_user(val, (void*)arg)))
return err;
if (val)
scsi_cmd[4] = 1;
scsi_cmd[4] = 0;

(and throw away the verify_area() calls -- but make sure
that you don't do get_user() after starting something
which is difficult to revert latter.)

> regards,
> ben.

/Matti Aarnio <>

 \ /
  Last update: 2005-03-22 13:38    [W:0.024 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site