Re: [PATCH] drm/nouveau: Prevents NULL pointer dereference in nouveau_uvmm_sm_prepare

From: Yuran Pereira
Date: Wed Nov 15 2023 - 04:09:34 EST


Hello Danilo,
On Tue, Nov 14, 2023 at 05:23:59PM +0100, Danilo Krummrich wrote:
> Hi Yuran,
>
> op_map_prepare() can't be called with `args` being NULL, since when called
> through nouveau_uvmm_sm_unmap_prepare() we can't hit the DRM_GPUVA_OP_MAP
> case at all.
>
> Unmapping something never leads to a new mapping being created, it can lead
> to remaps though.
>
Yes, you're right. I certainly hadn't noticed that when I first
submitted this patch.
>
> This check is not required for the reason given above. If you like, you
> can change this patch up to remove the args check and add a comment like:
>
> /* args can't be NULL when called for a map operation. */
>
Sure, I'll do that, sounds reasonable.

Thank you for your feedback.

Yuran
>
> Yeah, I see how this unnecessary check made you think so.
>
> - Danilo
>
>