Index: git/drivers/video/fbmem.c
===================================================================
--- git.orig/drivers/video/fbmem.c	2006-04-13 00:22:28.000000000 +0100
+++ git/drivers/video/fbmem.c	2006-04-17 15:28:23.000000000 +0100
@@ -673,14 +673,23 @@
 	if (total_size == 0)
 		total_size = info->fix.smem_len;
 
-	if (p > total_size)
-		return 0;
+	if (p > total_size) {
+		printk(KERN_ERR "Big1\n");
+		return -EFBIG;
+	}
 
-	if (count >= total_size)
+	if (count >= total_size) {
+		printk(KERN_ERR "Big2 %d, %d\n",count, total_size);
+		err = -EFBIG;
 		count = total_size;
+	}
 
-	if (count + p > total_size)
+	if (count + p > total_size) {
+		printk(KERN_ERR "Big3 %d, %d, %d\n",p, count, total_size);
+		if (!err)
+			err = -ENOSPC;
 		count = total_size - p;
+	}
 
 	buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count,
 			 GFP_KERNEL);
@@ -722,7 +731,10 @@
 
 	kfree(buffer);
 
-	return (err) ? err : cnt;
+	if (cnt == 0)
+		printk(KERN_ERR "Zero cnt\n",cnt);
+
+	return (cnt) ? cnt : err;
 }
 
 #ifdef CONFIG_KMOD
