From: akpm@linux-foundation.org
To: mm-commits@vger.kernel.org
Cc: error27@gmail.com, airlied@linux.ie, chris@chris-wilson.co.uk,
eric@anholt.net, haihao.xiang@intel.com, nanhai.zou@intel.com,
zhenyuw@linux.intel.com
Subject: + i915-signedness-bugs-in-i915-ring-buffer.patch added to -mm tree
Date: Mon, 27 Sep 2010 14:46:55 -0700 [thread overview]
Message-ID: <201009272146.o8RLktpr018495@imap1.linux-foundation.org> (raw)
The patch titled
drivers/gpu/drm/i915/: fix signedness bugs in i915 ring buffer
has been added to the -mm tree. Its filename is
i915-signedness-bugs-in-i915-ring-buffer.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: drivers/gpu/drm/i915/: fix signedness bugs in i915 ring buffer
From: Dan Carpenter <error27@gmail.com>
"ring->space" is unsigned so it's never less than zero.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Eric Anholt <eric@anholt.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Zou Nan hai <nanhai.zou@intel.com>
Cc: Xiang Hai hao <haihao.xiang@intel.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/gpu/drm/i915/i915_dma.c | 7 ++++---
drivers/gpu/drm/i915/intel_ringbuffer.c | 21 ++++++++++++---------
2 files changed, 16 insertions(+), 12 deletions(-)
diff -puN drivers/gpu/drm/i915/i915_dma.c~i915-signedness-bugs-in-i915-ring-buffer drivers/gpu/drm/i915/i915_dma.c
--- a/drivers/gpu/drm/i915/i915_dma.c~i915-signedness-bugs-in-i915-ring-buffer
+++ a/drivers/gpu/drm/i915/i915_dma.c
@@ -109,9 +109,10 @@ void i915_kernel_lost_context(struct drm
ring->head = I915_READ(PRB0_HEAD) & HEAD_ADDR;
ring->tail = I915_READ(PRB0_TAIL) & TAIL_ADDR;
- ring->space = ring->head - (ring->tail + 8);
- if (ring->space < 0)
- ring->space += ring->size;
+ if (ring->head >= ring->tail + 8)
+ ring->space = ring->head - (ring->tail + 8);
+ else
+ ring->space = ring->head - (ring->tail + 8) + ring->size;
if (!dev->primary->master)
return;
diff -puN drivers/gpu/drm/i915/intel_ringbuffer.c~i915-signedness-bugs-in-i915-ring-buffer drivers/gpu/drm/i915/intel_ringbuffer.c
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c~i915-signedness-bugs-in-i915-ring-buffer
+++ a/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -208,9 +208,10 @@ static int init_ring_common(struct drm_d
else {
ring->head = ring->get_head(dev, ring);
ring->tail = ring->get_tail(dev, ring);
- ring->space = ring->head - (ring->tail + 8);
- if (ring->space < 0)
- ring->space += ring->size;
+ if (ring->head >= ring->tail + 8)
+ ring->space = ring->head - (ring->tail + 8);
+ else
+ ring->space = ring->head - (ring->tail + 8) + ring->size;
}
return 0;
}
@@ -670,9 +671,10 @@ int intel_init_ring_buffer(struct drm_de
else {
ring->head = ring->get_head(dev, ring);
ring->tail = ring->get_tail(dev, ring);
- ring->space = ring->head - (ring->tail + 8);
- if (ring->space < 0)
- ring->space += ring->size;
+ if (ring->head >= ring->tail + 8)
+ ring->space = ring->head - (ring->tail + 8);
+ else
+ ring->space = ring->head - (ring->tail + 8) + ring->size;
}
INIT_LIST_HEAD(&ring->active_list);
INIT_LIST_HEAD(&ring->request_list);
@@ -739,9 +741,10 @@ int intel_wait_ring_buffer(struct drm_de
end = jiffies + 3 * HZ;
do {
ring->head = ring->get_head(dev, ring);
- ring->space = ring->head - (ring->tail + 8);
- if (ring->space < 0)
- ring->space += ring->size;
+ if (ring->head >= ring->tail + 8)
+ ring->space = ring->head - (ring->tail + 8);
+ else
+ ring->space = ring->head - (ring->tail + 8) + ring->size;
if (ring->space >= n) {
trace_i915_ring_wait_end (dev);
return 0;
_
Patches currently in -mm which might be from error27@gmail.com are
origin.patch
linux-next.patch
drivers-char-agp-parisc-agpc-eliminate-memory-leak.patch
i915-signedness-bugs-in-i915-ring-buffer.patch
rocket-release_region-or-error-path.patch
affs-testing-the-wrong-variable.patch
reply other threads:[~2010-09-27 21:47 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=201009272146.o8RLktpr018495@imap1.linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=airlied@linux.ie \
--cc=chris@chris-wilson.co.uk \
--cc=eric@anholt.net \
--cc=error27@gmail.com \
--cc=haihao.xiang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=nanhai.zou@intel.com \
--cc=zhenyuw@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox