Commit 6ae62940 authored by Antonino Daplas's avatar Antonino Daplas Committed by Linus Torvalds

[PATCH] fbdev: Fix software blanking code

The code in fbmem.c:fb_blank() is broken.  For drivers without an fb_blank
hook, an FBIO_BLANK ioctl will produce wrong colors or will segfault.
Signed-off-by: default avatarAntonino Daplas <adaplas@pol.net>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 91d9733c
......@@ -860,17 +860,19 @@ fb_blank(struct fb_info *info, int blank)
if (info->fbops->fb_blank && !info->fbops->fb_blank(blank, info))
return 0;
cmap = info->cmap;
if (blank) {
black = kmalloc(sizeof(u16) * info->cmap.len, GFP_KERNEL);
if (!black) {
if (black) {
memset(black, 0, info->cmap.len * sizeof(u16));
cmap.red = cmap.green = cmap.blue = black;
cmap.transp = info->cmap.transp ? black : NULL;
cmap.start = info->cmap.start;
cmap.len = info->cmap.len;
}
} else
cmap = info->cmap;
}
err = fb_set_cmap(&cmap, info);
kfree(black);
......
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