patch-2.4.27 linux-2.4.27/arch/x86_64/kernel/mtrr.c

Next file: linux-2.4.27/arch/x86_64/kernel/pci-gart.c
Previous file: linux-2.4.27/arch/x86_64/kernel/mpparse.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.26/arch/x86_64/kernel/mtrr.c linux-2.4.27/arch/x86_64/kernel/mtrr.c
@@ -961,16 +961,19 @@
 static ssize_t mtrr_read (struct file *file, char *buf, size_t len,
 		loff_t * ppos)
 {
-	if (*ppos >= ascii_buf_bytes)
+	loff_t n = *ppos;
+	unsigned pos = n;
+
+	if (pos != n || pos >= ascii_buf_bytes)
 		return 0;
 
-	if (*ppos + len > ascii_buf_bytes)
-		len = ascii_buf_bytes - *ppos;
+	if (len > ascii_buf_bytes - pos)
+		len = ascii_buf_bytes - pos;
 
-	if (copy_to_user (buf, ascii_buffer + *ppos, len))
+	if (copy_to_user (buf, ascii_buffer + pos, len))
 		return -EFAULT;
 
-	*ppos += len;
+	*ppos = pos + len;
 	return len;
 }
 

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