public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>,
	intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: [patch] drm/i915: cleanup a min_t() cast
Date: Fri, 20 Sep 2013 14:20:18 +0300	[thread overview]
Message-ID: <20130920112018.GA8655@elgon.mountain> (raw)

The lower layers of sysfs will not allow an "offset" of more than
GEN7_L3LOG_SIZE and also l3_access_valid() caps it a second time.  But
it's a little easier to audit if we don't have to worry that the
subtraction will result in negative values.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index d572435..b3f62b4 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -127,7 +127,7 @@ i915_l3_read(struct file *filp, struct kobject *kobj,
 	if (ret)
 		return ret;
 
-	count = min_t(int, GEN7_L3LOG_SIZE-offset, count);
+	count = min_t(size_t, GEN7_L3LOG_SIZE - offset, count);
 
 	ret = i915_mutex_lock_interruptible(drm_dev);
 	if (ret)

             reply	other threads:[~2013-09-20 11:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20 11:20 Dan Carpenter [this message]
2013-09-20 21:50 ` [patch] drm/i915: cleanup a min_t() cast Daniel Vetter

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=20130920112018.GA8655@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.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