[PATCH 2/8] fbdev: Support for bigger than 16x32 fonts in softcursor

DORMANTno replies

From: Antonino A. Daplas <hidden>
Date: 2004-11-11 02:26:38

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 <redacted>
---

 softcursor.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff -Nru a/drivers/video/softcursor.c b/drivers/video/softcursor.c
--- a/drivers/video/softcursor.c	2004-10-23 02:52:37 +08:00
+++ b/drivers/video/softcursor.c	2004-11-08 18:10:58 +08:00
@@ -28,16 +28,17 @@
 	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);





-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help