patch-2.4.27 linux-2.4.27/drivers/usb/host/uhci-debug.h
Next file: linux-2.4.27/drivers/usb/printer.c
Previous file: linux-2.4.27/drivers/usb/host/ehci-sched.c
Back to the patch index
Back to the overall index
-  Lines: 30
-  Date:
2004-08-07 16:26:05.795393661 -0700
-  Orig file: 
linux-2.4.26/drivers/usb/host/uhci-debug.h
-  Orig date: 
2003-11-28 10:26:20.000000000 -0800
diff -urN linux-2.4.26/drivers/usb/host/uhci-debug.h linux-2.4.27/drivers/usb/host/uhci-debug.h
@@ -530,16 +530,14 @@
 			loff_t *ppos)
 {
 	struct uhci_proc *up = file->private_data;
-	unsigned int pos;
+	loff_t n = *ppos;
+	unsigned int pos = n;
 	unsigned int size;
 
-	pos = *ppos;
 	size = up->size;
-	if (pos >= size)
+	if (pos != n || pos >= size)
 		return 0;
-	if (nbytes >= size)
-		nbytes = size;
-	if (pos + nbytes > size)
+	if (nbytes > size - pos)
 		nbytes = size - pos;
 
 	if (!access_ok(VERIFY_WRITE, buf, nbytes))
@@ -548,7 +546,7 @@
 	if (copy_to_user(buf, up->data + pos, nbytes))
 		return -EFAULT;
 
-	*ppos += nbytes;
+	*ppos = pos + nbytes;
 
 	return nbytes;
 }
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)