patch-2.4.27 linux-2.4.27/drivers/sbus/char/flash.c
Next file: linux-2.4.27/drivers/scsi/ChangeLog.ips
Previous file: linux-2.4.27/drivers/s390/s390io.c
Back to the patch index
Back to the overall index
- Lines: 26
- Date:
2004-08-07 16:26:05.488381047 -0700
- Orig file:
linux-2.4.26/drivers/sbus/char/flash.c
- Orig date:
2004-02-18 05:36:31.000000000 -0800
diff -urN linux-2.4.26/drivers/sbus/char/flash.c linux-2.4.27/drivers/sbus/char/flash.c
@@ -105,9 +105,15 @@
flash_read(struct file * file, char * buf,
size_t count, loff_t *ppos)
{
- unsigned long p = file->f_pos;
+ loff_t p = *ppos;
int i;
+ if (p > flash.read_size)
+ return 0;
+
+ if (p < 0)
+ return -EINVAL;
+
if (count > flash.read_size - p)
count = flash.read_size - p;
@@ -118,7 +124,7 @@
buf++;
}
- file->f_pos += count;
+ *ppos = p + count;
return count;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)