All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: yakui.zhao@intel.com
Cc: dri-devel@lists.freedesktop.org
Subject: [bug report] gma500/cdv: Add eDP support
Date: Tue, 13 Jun 2017 10:23:35 +0300	[thread overview]
Message-ID: <20170613072335.GA32356@elgon.mountain> (raw)

[  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

                 reply	other threads:[~2017-06-13  7:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170613072335.GA32356@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=yakui.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.