dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: bskeggs@redhat.com
Cc: dri-devel@lists.freedesktop.org
Subject: re: drm/nvd0/disp: initial crtc object implementation
Date: Wed, 27 Nov 2013 00:30:27 +0300	[thread overview]
Message-ID: <20131126213027.GA20597@elgon.mountain> (raw)

Hello Ben Skeggs,

The patch 438d99e3b175: "drm/nvd0/disp: initial crtc object 
implementation" from Jul 5, 2011, leads to the following
static checker warning: "drivers/gpu/drm/nouveau/nv50_display.c:1272 
nv50_crtc_gamma_set()
	 error: buffer overflow 'nv_crtc->lut.r' 256 <= 256"

drivers/gpu/drm/nouveau/nv50_display.c
  1263  static void
  1264  nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
  1265                      uint32_t start, uint32_t size)
  1266  {
  1267          struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
  1268          u32 end = max(start + size, (u32)256);
  1269          u32 i;
  1270  
  1271          for (i = start; i < end; i++) {
  1272                  nv_crtc->lut.r[i] = r[i];
                                 ^^^^^^^^
These arrays have 256 elements so going beyond seems like a bug.  Should
the end = max() be a min() or something?

  1273                  nv_crtc->lut.g[i] = g[i];
  1274                  nv_crtc->lut.b[i] = b[i];
  1275          }
  1276  
  1277          nv50_crtc_lut_load(crtc);
  1278  }

regards,
dan carpenter

             reply	other threads:[~2013-11-26 21:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26 21:30 Dan Carpenter [this message]
2013-11-26 23:22 ` drm/nvd0/disp: initial crtc object implementation Ben Skeggs
2013-11-27 22:18   ` [patch] drm/nv50/disp: min/max are reversed in nv50_crtc_gamma_set() Dan Carpenter

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=20131126213027.GA20597@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox