From: Vivek Kasireddy <vivek.kasireddy@intel.com>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: "Christian König" <christian.koenig@amd.com>
Subject: [Intel-gfx] [PATCH v2 1/3] drm/mm: Ensure that the entry is not NULL before extracting rb_node
Date: Wed, 16 Feb 2022 23:50:12 -0800 [thread overview]
Message-ID: <20220217075014.922605-2-vivek.kasireddy@intel.com> (raw)
In-Reply-To: <20220217075014.922605-1-vivek.kasireddy@intel.com>
While looking for next holes suitable for an allocation, although,
it is highly unlikely, make sure that the DECLARE_NEXT_HOLE_ADDR
macro is using a valid node before it extracts the rb_node from it.
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
drivers/gpu/drm/drm_mm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 8257f9d4f619..499d8874e4ed 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -389,11 +389,12 @@ first_hole(struct drm_mm *mm,
#define DECLARE_NEXT_HOLE_ADDR(name, first, last) \
static struct drm_mm_node *name(struct drm_mm_node *entry, u64 size) \
{ \
- struct rb_node *parent, *node = &entry->rb_hole_addr; \
+ struct rb_node *parent, *node; \
\
- if (!entry || RB_EMPTY_NODE(node)) \
+ if (!entry || RB_EMPTY_NODE(&entry->rb_hole_addr)) \
return NULL; \
\
+ node = &entry->rb_hole_addr; \
if (usable_hole_addr(node->first, size)) { \
node = node->first; \
while (usable_hole_addr(node->last, size)) \
--
2.34.1
next prev parent reply other threads:[~2022-02-17 8:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-17 7:50 [Intel-gfx] [PATCH v2 0/3] drm/mm: Add an iterator to optimally walk over holes suitable for an allocation Vivek Kasireddy
2022-02-17 7:50 ` Vivek Kasireddy [this message]
2022-02-17 9:09 ` [Intel-gfx] [PATCH v2 1/3] drm/mm: Ensure that the entry is not NULL before extracting rb_node Tvrtko Ursulin
2022-02-18 3:47 ` Kasireddy, Vivek
2022-02-21 12:39 ` Tvrtko Ursulin
2022-02-23 4:35 ` Kasireddy, Vivek
2022-02-23 14:03 ` Tvrtko Ursulin
2022-02-17 7:50 ` [Intel-gfx] [PATCH v2 2/3] drm/mm: Add an iterator to optimally walk over holes for an allocation (v4) Vivek Kasireddy
2022-02-17 7:50 ` [Intel-gfx] [PATCH v2 3/3] drm/i915/gem: Don't try to map and fence large scanout buffers (v8) Vivek Kasireddy
2022-02-17 9:19 ` Tvrtko Ursulin
2022-02-17 18:48 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/mm: Add an iterator to optimally walk over holes suitable for an allocation (rev2) Patchwork
2022-02-17 18:51 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-02-17 19:13 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-02-18 5:14 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
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=20220217075014.922605-2-vivek.kasireddy@intel.com \
--to=vivek.kasireddy@intel.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@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