MLK-13839 fbdev: mxsfb: Fix null pointer dereference
authorCristina Ciocan <cristina-mihaela.ciocan@nxp.com>
Fri, 3 Feb 2017 17:32:44 +0000 (19:32 +0200)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:10:40 +0000 (15:10 -0500)
In function mxsfb_check_var an explicit null pointer dereference occurs
when input frame is 32 bpp (var->bits_per_pixel) and the output frame is
different from 8/16/18/24 (host->ld_intf_width).

Even though a 32bpp output is possible under certain conditions, this is
currently not implemented, so any other output bpp value is not valid.

Signed-off-by: Cristina Ciocan <cristina-mihaela.ciocan@nxp.com>
drivers/video/fbdev/mxsfb.c

index 1b3be43..e0a1199 100644 (file)
@@ -4,6 +4,7 @@
  * This code is based on:
  * Author: Vitaly Wool <vital@embeddedalley.com>
  *
+ * Copyright 2017 NXP
  * Copyright 2008-2015 Freescale Semiconductor, Inc. All Rights Reserved.
  * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
  *
@@ -633,6 +634,15 @@ static int mxsfb_check_var(struct fb_var_screeninfo *var,
                        /* real 24 bit */
                        rgb = def_rgb888;
                        break;
+               default:
+                       /*
+                        * 32-bit output is possible through I/O muxing, if this
+                        * option is available on chip. Currently not
+                        * implemented.
+                        */
+                       pr_debug("Currently unsupported output colour depth: %u\n",
+                                host->ld_intf_width);
+                       return -EINVAL;
                }
                break;
        default: