[bug report] gma500/cdv: Add eDP support

Dan Carpenter dan.carpenter at oracle.com
Tue Jun 13 07:23:35 UTC 2017


[  This is a warning about very old code.  -dan ]

Hello Zhao Yakui,

The patch d112a8163f83: "gma500/cdv: Add eDP support" from Aug 8,
2012, leads to the following static checker warnings:

	drivers/gpu/drm/gma500/intel_bios.c:77 parse_edp()
	warn: right shifting more than type allows 32 vs 510

	drivers/gpu/drm/gma500/intel_bios.c:90 parse_edp()
	warn: buffer overflow 'edp->power_seqs' 16 <= 255

drivers/gpu/drm/gma500/intel_bios.c
    75  
    76          panel_type = dev_priv->panel_type;
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
panel_type can be 0xff.  It get's set in parse_lfp_panel_data().  If
it's 0xff we return early but the error handling seems not very complete
because here we are with it still set to 0xff.

    77          switch ((edp->color_depth >> (panel_type * 2)) & 3) {
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
shift to zero.

    78          case EDP_18BPP:
    79                  dev_priv->edp.bpp = 18;
    80                  break;
    81          case EDP_24BPP:
    82                  dev_priv->edp.bpp = 24;
    83                  break;
    84          case EDP_30BPP:
    85                  dev_priv->edp.bpp = 30;
    86                  break;
    87          }
    88  
    89          /* Get the eDP sequencing and link info */
    90          edp_pps = &edp->power_seqs[panel_type];
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
buffer overflow.

    91          edp_link_params = &edp->link_params[panel_type];
    92  

regards,
dan carpenter


More information about the dri-devel mailing list