patch-2.4.19 linux-2.4.19/drivers/block/paride/pg.c
Next file: linux-2.4.19/drivers/block/paride/ppc6lnx.c
Previous file: linux-2.4.19/drivers/block/paride/paride.h
Back to the patch index
Back to the overall index
- Lines: 36
- Date:
Fri Aug 2 17:39:43 2002
- Orig file:
linux-2.4.18/drivers/block/paride/pg.c
- Orig date:
Fri Dec 21 09:41:53 2001
diff -urN linux-2.4.18/drivers/block/paride/pg.c linux-2.4.19/drivers/block/paride/pg.c
@@ -628,7 +628,8 @@
if (PG.busy) return -EBUSY;
if (count < hs) return -EINVAL;
- copy_from_user((char *)&hdr,buf,hs);
+ if (copy_from_user((char *)&hdr, buf, hs))
+ return -EFAULT;
if (hdr.magic != PG_MAGIC) return -EINVAL;
if (hdr.dlen > PG_MAX_DATA) return -EINVAL;
@@ -652,8 +653,8 @@
PG.busy = 1;
- copy_from_user(PG.bufptr,buf+hs,count-hs);
-
+ if (copy_from_user(PG.bufptr, buf + hs, count - hs))
+ return -EFAULT;
return count;
}
@@ -687,9 +688,11 @@
hdr.duration = (jiffies - PG.start + HZ/2) / HZ;
hdr.scsi = PG.status & 0x0f;
- copy_to_user(buf,(char *)&hdr,hs);
- if (copy > 0) copy_to_user(buf+hs,PG.bufptr,copy);
-
+ if (copy_to_user(buf, (char *)&hdr, hs))
+ return -EFAULT;
+ if (copy > 0)
+ if (copy_to_user(buf+hs,PG.bufptr,copy))
+ return -EFAULT;
return copy+hs;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)