patch-2.4.19 linux-2.4.19/drivers/block/paride/pt.c

Next file: linux-2.4.19/drivers/block/rd.c
Previous file: linux-2.4.19/drivers/block/paride/ppc6lnx.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/drivers/block/paride/pt.c linux-2.4.19/drivers/block/paride/pt.c
@@ -864,7 +864,10 @@
 		    n -= k;
 		    b = k;
 		    if (b > count) b = count;
-		    copy_to_user(buf+t,PT.bufptr,b);
+		    if (copy_to_user(buf + t, PT.bufptr, b)) {
+	    		pi_disconnect(PI);
+			return -EFAULT;
+		    }
 		    t += b;
 		    count -= b;
 	        }
@@ -948,7 +951,10 @@
 		    if (k > PT_BUFSIZE) k = PT_BUFSIZE;
 		    b = k;
 		    if (b > count) b = count;
-		    copy_from_user(PT.bufptr,buf+t,b);
+		    if (copy_from_user(PT.bufptr, buf + t, b)) {
+			pi_disconnect(PI);
+			return -EFAULT;
+		    }
                     pi_write_block(PI,PT.bufptr,k);
 		    t += b;
 		    count -= b;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)