patch-2.4.27 linux-2.4.27/arch/i386/kernel/mtrr.c
Next file: linux-2.4.27/arch/i386/kernel/pci-irq.c
Previous file: linux-2.4.27/arch/i386/kernel/mpparse.c
Back to the patch index
Back to the overall index
- Lines: 23
- Date:
2004-08-07 16:26:04.553342627 -0700
- Orig file:
linux-2.4.26/arch/i386/kernel/mtrr.c
- Orig date:
2003-06-13 07:51:29.000000000 -0700
diff -urN linux-2.4.26/arch/i386/kernel/mtrr.c linux-2.4.27/arch/i386/kernel/mtrr.c
@@ -1648,11 +1648,17 @@
static ssize_t mtrr_read (struct file *file, char *buf, size_t len,
loff_t *ppos)
{
- if (*ppos >= ascii_buf_bytes) return 0;
- if (*ppos + len > ascii_buf_bytes) len = ascii_buf_bytes - *ppos;
- if ( copy_to_user (buf, ascii_buffer + *ppos, len) ) return -EFAULT;
- *ppos += len;
- return len;
+ loff_t pos = *ppos;
+ if (pos < 0 || pos >= ascii_buf_bytes)
+ return 0;
+ if (len > ascii_buf_bytes - pos)
+ len = ascii_buf_bytes - pos;
+ if (copy_to_user(buf, ascii_buffer + pos, len))
+ return -EFAULT;
+ pos += len;
+ *ppos = pos;
+
+ return len;
} /* End Function mtrr_read */
static ssize_t mtrr_write (struct file *file, const char *buf, size_t len,
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)