patch-2.4.27 linux-2.4.27/drivers/macintosh/ans-lcd.c

Next file: linux-2.4.27/drivers/macintosh/nvram.c
Previous file: linux-2.4.27/drivers/isdn/sc/command.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.26/drivers/macintosh/ans-lcd.c linux-2.4.27/drivers/macintosh/ans-lcd.c
@@ -53,7 +53,6 @@
 				size_t count, loff_t *ppos )
 {
 	const char * p = buf;
-	int i;
 
 #ifdef DEBUG
 	printk(KERN_DEBUG "LCD: write\n");
@@ -61,13 +60,13 @@
 
 	if ( verify_area(VERIFY_READ, buf, count) )
 		return -EFAULT;
-	for ( i = *ppos; count > 0; ++i, ++p, --count ) 
-	{
+	while (count--) {
 		char c;
-		__get_user(c, p);
+		if (__get_user(c, p++))
+			return -EFAULT;
 		anslcd_write_byte_data( c );
 	}
-	*ppos = i;
+	*ppos = p - buf;
 	return p - buf;
 }
 

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