Re: cdu31a.c

Andi Kleen (ak@muc.de)
15 Oct 1998 12:36:23 +0200


In article <Pine.LNX.4.02.9810142106380.1389-100000@manjak.knm.org.pl>,
"Krzysztof G. Baranowski" <kgb@manjak.knm.org.pl> writes:

> -
> +
> + copy_from_user(&ra, (char *) arg, sizeof(ra));
> +
> if (ra.nframes == 0)
> {
> return 0;
> }
> -
> - i=verify_area(VERIFY_WRITE, ra.buf, CD_FRAMESIZE_RAW * ra.nframes);
> - if(i<0)
> - return i;
> - copy_from_user(&ra, (char *) arg, sizeof(ra));

But you should really check the return value of copy_from_user...
Better use something like this:

if (copy_from_user(&ra, (char *) arg, sizeof(ra)))
return -EFAULT;

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/