From: Danilo Krummrich <dakr@redhat.com>
To: Yuran Pereira <yuran.pereira@hotmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
daniel@ffwll.ch, nouveau@lists.freedesktop.org
Subject: Re: [Nouveau] [PATCH] drm/nouveau: Removes unnecessary args check in nouveau_uvmm_sm_prepare
Date: Thu, 30 Nov 2023 01:08:57 +0100 [thread overview]
Message-ID: <feefd689-780c-4314-a020-00826e09472a@redhat.com> (raw)
In-Reply-To: <GV1PR10MB65637F4BAABFE2D8E261E1DCE8B0A@GV1PR10MB6563.EURPRD10.PROD.OUTLOOK.COM>
On 11/16/23 21:52, Yuran Pereira wrote:
> Checking `args` after calling `op_map_prepare` is unnecessary since
> if `op_map_prepare` was to be called with NULL args, it would lead
> to a NULL pointer dereference, thus never hitting that check.
>
> Hence this check can be removed, and a note added to remind users of
> this function to ensure that args != NULL when calling this function
> for a map operation as it was suggested by Danilo [1]
>
> [1] https://lore.kernel.org/lkml/6a1ebcef-bade-45a0-9bd9-c05f0226eb88@redhat.com
>
> Suggested-by: Danilo Krummrich <dakr@redhat.com>
> Signed-off-by: Yuran Pereira <yuran.pereira@hotmail.com>
Applied to drm-misc-next.
> ---
> drivers/gpu/drm/nouveau/nouveau_uvmm.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_uvmm.c b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
> index 5cf892c50f43..c8c3f1b1b604 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_uvmm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_uvmm.c
> @@ -604,6 +604,10 @@ op_unmap_prepare(struct drm_gpuva_op_unmap *u)
> drm_gpuva_unmap(u);
> }
>
> +/*
> + * Note: @args should not be NULL when calling for
> + * a map operation.
> + */
> static int
> nouveau_uvmm_sm_prepare(struct nouveau_uvmm *uvmm,
> struct nouveau_uvma_prealloc *new,
> @@ -624,7 +628,7 @@ nouveau_uvmm_sm_prepare(struct nouveau_uvmm *uvmm,
> if (ret)
> goto unwind;
>
> - if (args && vmm_get_range) {
> + if (vmm_get_range) {
> ret = nouveau_uvmm_vmm_get(uvmm, vmm_get_start,
> vmm_get_range);
> if (ret) {
prev parent reply other threads:[~2023-11-30 0:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 20:52 [PATCH] drm/nouveau: Removes unnecessary args check in nouveau_uvmm_sm_prepare Yuran Pereira
2023-11-30 0:08 ` Danilo Krummrich [this message]
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=feefd689-780c-4314-a020-00826e09472a@redhat.com \
--to=dakr@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=yuran.pereira@hotmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).