patch-2.4.27 linux-2.4.27/net/atm/mpoa_proc.c

Next file: linux-2.4.27/net/bluetooth/af_bluetooth.c
Previous file: linux-2.4.27/net/atm/lec_arpc.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.26/net/atm/mpoa_proc.c linux-2.4.27/net/atm/mpoa_proc.c
@@ -109,6 +109,7 @@
 	eg_cache_entry *eg_entry;
 	struct timeval now;
 	unsigned char ip_string[16];
+	loff_t n = *pos;
 	if(count == 0)
 	        return 0;
 	page = get_free_page(GFP_KERNEL);
@@ -150,14 +151,14 @@
 		mpc = mpc->next;
 	}
 
-	if (*pos >= length) length = 0;
+	if (n != (unsigned)n || n >= length) length = 0;
 	else {
-	  if ((count + *pos) > length) count = length - *pos;
+	  if (count > length - n) count = length - n;
 	  if (copy_to_user(buff, (char *)page , count)) {
  		  free_page(page);
 		  return -EFAULT;
           }
-	  *pos += count;
+	  *pos = n + count;
 	}
 
  	free_page(page);

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