patch-2.4.27 linux-2.4.27/drivers/s390/block/dasd.c

Next file: linux-2.4.27/drivers/s390/char/tapechar.c
Previous file: linux-2.4.27/drivers/pnp/isapnp_proc.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.26/drivers/s390/block/dasd.c linux-2.4.27/drivers/s390/block/dasd.c
@@ -4655,15 +4655,17 @@
 		   loff_t * offset)
 {
 	loff_t len;
+	loff_t n = *offset;
+	unsigned pos = n;
 	tempinfo_t *p_info = (tempinfo_t *) file->private_data;
 
-	if (*offset >= p_info->len) {
+	if (n != pos || pos >= p_info->len) {
 		return 0;	/* EOF */
 	} else {
-		len = MIN (user_len, (p_info->len - *offset));
-		if (copy_to_user (user_buf, &(p_info->data[*offset]), len))
+		len = MIN (user_len, (p_info->len - pos));
+		if (copy_to_user (user_buf, &(p_info->data[pos]), len))
 			return -EFAULT;
-		(*offset) += len;
+		*offset = pos + len;
 		return len;	/* number of bytes "read" */
 	}
 }

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