Re: [PATCH] gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 27 Jul 2022 at 09:31, Zeng Jingxiang <zengjx95@xxxxxxxxx> wrote:
>
> From: Zeng Jingxiang <linuszeng@xxxxxxxxxxx>
>
> A NULL check for bridge->encoder shows that it may be NULL, but it
> already been dereferenced on all paths leading to the check.
> 812     if (!bridge->encoder) {
>
> Dereference the pointer bridge->encoder.
> 810     drm_connector_attach_encoder(&lt9611->connector, bridge->encoder);
>
> Signed-off-by: Zeng Jingxiang <linuszeng@xxxxxxxxxxx>
> ---
>  drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 7ef8fe5abc12..81a4751573fa 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -807,13 +807,14 @@ static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt961
>
>         drm_connector_helper_add(&lt9611->connector,
>                                  &lt9611_bridge_connector_helper_funcs);
> -       drm_connector_attach_encoder(&lt9611->connector, bridge->encoder);
>
>         if (!bridge->encoder) {
>                 DRM_ERROR("Parent encoder object not found");
>                 return -ENODEV;
>         }
>
> +       drm_connector_attach_encoder(&lt9611->connector, bridge->encoder);
> +
>         return 0;
>  }
>
> --
> 2.27.0
>

Applied to drm-misc-next.



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux