patch-2.3.49 linux/drivers/video/fbmem.c

Next file: linux/drivers/video/matrox/matroxfb_base.c
Previous file: linux/drivers/video/cyber2000fb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.48/linux/drivers/video/fbmem.c linux/drivers/video/fbmem.c
@@ -247,15 +247,20 @@
 			   int len, int *eof, void *private)
 {
 	struct fb_info **fi;
+	int clen;
 
-	len = 0;
+	clen = 0;
 	for (fi = registered_fb; fi < &registered_fb[FB_MAX] && len < 4000; fi++)
 		if (*fi)
-			len += sprintf(buf + len, "%d %s\n",
-				       GET_FB_IDX((*fi)->node),
-				       (*fi)->modename);
+			clen += sprintf(buf + clen, "%d %s\n",
+				        GET_FB_IDX((*fi)->node),
+				        (*fi)->modename);
 	*start = buf + offset;
-	return len > offset ? len - offset : 0;
+	if (clen > offset)
+		clen -= offset;
+	else
+		clen = 0;
+	return clen < len ? clen : len;
 }
 
 static ssize_t

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