Commit 44f4ee83 authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

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

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: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2a0f3635
...@@ -28,16 +28,17 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor) ...@@ -28,16 +28,17 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
if (info->state != FBINFO_STATE_RUNNING) if (info->state != FBINFO_STATE_RUNNING)
return 0; 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) if (!src)
return -ENOMEM; return -ENOMEM;
image = (struct fb_image *) (src + 64); image = (struct fb_image *) (src + dsize);
*image = cursor->image; *image = cursor->image;
s_pitch = (image->width + 7) >> 3;
dsize = s_pitch * image->height;
d_pitch = (s_pitch + scan_align) & ~scan_align; d_pitch = (s_pitch + scan_align) & ~scan_align;
size = d_pitch * image->height + buf_align; size = d_pitch * image->height + buf_align;
size &= ~buf_align; size &= ~buf_align;
dst = fb_get_buffer_offset(info, &info->pixmap, size); dst = fb_get_buffer_offset(info, &info->pixmap, size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment