All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] gma500/cdv: Add eDP support
@ 2017-06-13  7:23 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2017-06-13  7:23 UTC (permalink / raw)
  To: yakui.zhao; +Cc: dri-devel

[  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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-13  7:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-13  7:23 [bug report] gma500/cdv: Add eDP support Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.