patch-2.4.27 linux-2.4.27/drivers/block/rd.c
Next file: linux-2.4.27/drivers/block/sx8.c
Previous file: linux-2.4.27/drivers/block/cciss_scsi.c
Back to the patch index
Back to the overall index
- Lines: 24
- Date:
2004-08-07 16:26:04.677347723 -0700
- Orig file:
linux-2.4.26/drivers/block/rd.c
- Orig date:
2002-11-28 15:53:12.000000000 -0800
diff -urN linux-2.4.26/drivers/block/rd.c linux-2.4.27/drivers/block/rd.c
@@ -320,14 +320,19 @@
static ssize_t initrd_read(struct file *file, char *buf,
size_t count, loff_t *ppos)
{
- int left;
+ loff_t n = *ppos;
+ unsigned pos = n;
+ unsigned left = initrd_end - initrd_start;
- left = initrd_end - initrd_start - *ppos;
+ if (pos != n || pos >= left)
+ return 0;
+
+ left -= pos;
if (count > left) count = left;
if (count == 0) return 0;
- if (copy_to_user(buf, (char *)initrd_start + *ppos, count))
+ if (copy_to_user(buf, (char *)initrd_start + pos, count))
return -EFAULT;
- *ppos += count;
+ *ppos = pos + count;
return count;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)