From: "Christian König" <christian.koenig@amd.com>
To: Jing Xiangfeng <jingxiangfeng@huawei.com>,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@linux.ie, daniel@ffwll.ch,
nirmoy.das@amd.com
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/mm: prevent a potential null-pointer dereference
Date: Thu, 10 Sep 2020 10:58:21 +0200 [thread overview]
Message-ID: <f6c93d83-b47d-a004-8da9-92305024c4b7@amd.com> (raw)
In-Reply-To: <20200910023858.43759-1-jingxiangfeng@huawei.com>
Am 10.09.20 um 04:38 schrieb Jing Xiangfeng:
> The macro 'DECLARE_NEXT_HOLE_ADDR' may hit a potential null-pointer
> dereference. So use 'entry' after checking it.
I don't see a potential null-pointer dereference here.
Where should that be?
Christian.
>
> Fixes: 5fad79fd66ff ("drm/mm: cleanup and improve next_hole_*_addr()")
> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
> ---
> drivers/gpu/drm/drm_mm.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
> index a4a04d246135..6fcf70f71962 100644
> --- a/drivers/gpu/drm/drm_mm.c
> +++ b/drivers/gpu/drm/drm_mm.c
> @@ -392,11 +392,14 @@ 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) \
> return NULL; \
> \
> + node = &entry->rb_hole_addr; \
> + if (RB_EMPTY_NODE(node)) \
> + return NULL; \
> if (usable_hole_addr(node->first, size)) { \
> node = node->first; \
> while (usable_hole_addr(node->last, size)) \
next prev parent reply other threads:[~2020-09-10 8:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-10 2:38 Jing Xiangfeng
2020-09-10 8:58 ` Christian König [this message]
2020-09-10 12:35 ` Jing Xiangfeng
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=f6c93d83-b47d-a004-8da9-92305024c4b7@amd.com \
--to=christian.koenig@amd.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jingxiangfeng@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=nirmoy.das@amd.com \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®