lkml.org 
[lkml]   [1997]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: get_user <-> scsi-idle
> 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.

The new exception handling code in 2.1.x gets rid of the need for
verify_area. get_user and put_user can now "detect" memory access
problems. Thus, the new first argument is the variable to assign the
contents of the second memory location to. The return value is the
status of the userspace read.

Here would be the 2.1.x version of that code:

long tmp;

if (get_user(tmp, (long *) arg))
return -EFAULT;

if (tmp)
scsi_cmd[4] = 1;
else
scsi_cmd[4] = 0;

Tom

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