uterm: video_fbdev: test whether bpp is power of 8
I have never seen something different but lets be sure here and test for modulo-8. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
1 parent
f7e6e1b19b
commit
8c64daa5df
2 files changed
+8
No files matched your search
@@ -161,6 +161,7 @@ struct fbdev_display {
|
||||
size_t len;
|
||||
void *map;
|
||||
unsigned int stride;
|
||||
unsigned int bpp;
|
||||
};
|
||||
|
||||
struct fbdev_video {
|
||||
|
||||
@@ -159,6 +159,12 @@ static int display_activate_force(struct uterm_display *disp,
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (vinfo->bits_per_pixel % 8) {
|
||||
log_error("device %s uses no power of 8 bpp: %u",
|
||||
disp->fbdev.node, vinfo->bits_per_pixel);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (finfo->visual != FB_VISUAL_TRUECOLOR ||
|
||||
vinfo->bits_per_pixel < 16) {
|
||||
log_error("device %s does not support true-color bpp >= 16",
|
||||
@@ -201,6 +207,7 @@ static int display_activate_force(struct uterm_display *disp,
|
||||
disp->fbdev.xres = vinfo->xres;
|
||||
disp->fbdev.yres = vinfo->yres;
|
||||
disp->fbdev.len = len;
|
||||
disp->fbdev.bpp = vinfo->bits_per_pixel / 8;
|
||||
disp->fbdev.bufid = 0;
|
||||
|
||||
disp->flags |= DISPLAY_ONLINE;
|
||||
|
||||
Reference in new issue
Block a user