summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-11-13 08:36:52 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-11-13 08:37:13 +0100
commit92327f1f6e57962b75e525eb34e11dfa03191332 (patch)
treed0df3bba7a80f234fdf86be05aab35c0fbdf9f59 /lib
parent8331fc5c1e6b99db4e5d94bc124bad5affe83059 (diff)
downloadbarebox-92327f1f6e57962b75e525eb34e11dfa03191332.tar.gz
barebox-92327f1f6e57962b75e525eb34e11dfa03191332.tar.xz
graphics_utils: check for valid framebuffer before creating a screen
Otherwise we crash later when we try to print on that screen. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/gui/graphic_utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c
index 4c1885d55b..2fe9fa358a 100644
--- a/lib/gui/graphic_utils.c
+++ b/lib/gui/graphic_utils.c
@@ -249,6 +249,10 @@ struct screen *fb_create_screen(struct fb_info *info)
{
struct screen *sc;
+ if (!info->xres || !info->yres || !info->line_length ||
+ !info->screen_base)
+ return ERR_PTR(-EINVAL);
+
sc = xzalloc(sizeof(*sc));
sc->s.x = 0;