
From: "Antonino A. Daplas" <adaplas@hotpop.com>

Fix crash if font font is bigger than 16x32 by dynamically allocating buffer
based on font dimensions instead of statically allocating at 64 bytes.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/video/softcursor.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff -puN drivers/video/softcursor.c~fbdev-support-for-bigger-than-16x32-fonts-in-softcursor drivers/video/softcursor.c
--- 25/drivers/video/softcursor.c~fbdev-support-for-bigger-than-16x32-fonts-in-softcursor	2004-11-10 18:36:08.100166936 -0800
+++ 25-akpm/drivers/video/softcursor.c	2004-11-10 18:36:08.104166328 -0800
@@ -28,16 +28,17 @@ int soft_cursor(struct fb_info *info, st
 	if (info->state != FBINFO_STATE_RUNNING)
 		return 0;
 
-	src = kmalloc(64 + sizeof(struct fb_image), GFP_ATOMIC);
+	s_pitch = (cursor->image.width + 7) >> 3;
+	dsize = s_pitch * cursor->image.height;
 
+	src = kmalloc(dsize + sizeof(struct fb_image), GFP_ATOMIC);
 	if (!src)
 		return -ENOMEM;
 
-	image = (struct fb_image *) (src + 64);
+	image = (struct fb_image *) (src + dsize);
 	*image = cursor->image;
-	s_pitch = (image->width + 7) >> 3;
-	dsize = s_pitch * image->height;
 	d_pitch = (s_pitch + scan_align) & ~scan_align;
+
 	size = d_pitch * image->height + buf_align;
 	size &= ~buf_align;
 	dst = fb_get_buffer_offset(info, &info->pixmap, size);
_
