[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b441d8e53c9b5e95da447b3681bb9143448388fc.camel@redhat.com>
Date: Tue, 20 Jun 2023 15:48:25 -0400
From: Lyude Paul <lyude@...hat.com>
To: Chenyuan Mi <cymi20@...an.edu.cn>, airlied@...il.com
Cc: daniel@...ll.ch, jani.nikula@...el.com, Wayne.Lin@....com,
imre.deak@...el.com, alexander.deucher@....com,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/display/dp_mst: Fix missing check for return value
of drm_atomic_get_mst_payload_state()
Hm, I suppose it's not -impossible- for this to return NULL, but if it does
return NULL that absolutely means something broke well before this point in
the code. More comments below:
On Wed, 2023-06-14 at 09:09 -0700, Chenyuan Mi wrote:
> The drm_atomic_get_mst_payload_state() function may
> return NULL, which may cause null pointer deference,
> and most other callsites of drm_atomic_get_mst_payload_state()
> do Null check. Add Null check for return value of
> drm_atomic_get_mst_payload_state().
>
> Found by our static analysis tool.
>
> Signed-off-by: Chenyuan Mi <cymi20@...an.edu.cn>
> ---
> drivers/gpu/drm/display/drm_dp_mst_topology.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> index 38dab76ae69e..27f4bcf409ea 100644
> --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> @@ -4434,6 +4434,8 @@ void drm_dp_mst_atomic_wait_for_dependencies(struct drm_atomic_state *state)
>
> new_payload = drm_atomic_get_mst_payload_state(new_mst_state,
> old_payload->port);
> + if (!new_payload)
> + continue;
Could you change this check to:
if (drm_WARN_ON(state->dev, !new_payload))
> new_payload->vc_start_slot = old_payload->vc_start_slot;
> }
> }
--
Cheers,
Lyude Paul (she/her)
Software Engineer at Red Hat
Powered by blists - more mailing lists