[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFBinCATiUnR=P9VRBxWeQhf49k6PVxK+nU95G7w94f-mR2HWQ@mail.gmail.com>
Date: Sat, 10 Aug 2024 11:09:40 +0200
From: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
To: Anastasia Belova <abelova@...ralinux.ru>
Cc: Neil Armstrong <neil.armstrong@...aro.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
Kevin Hilman <khilman@...libre.com>, Jerome Brunet <jbrunet@...libre.com>,
dri-devel@...ts.freedesktop.org, linux-amlogic@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
lvc-project@...uxtesting.org
Subject: Re: [PATCH] drm/meson: add check to prevent dereference of NULL
Hello Anastasia,
Thank you for working on this!
On Fri, Aug 9, 2024 at 2:48 PM Anastasia Belova <abelova@...ralinux.ru> wrote:
[...]
> @@ -373,9 +373,11 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
> free_drm:
> drm_dev_put(drm);
>
> - meson_encoder_dsi_remove(priv);
> - meson_encoder_hdmi_remove(priv);
> - meson_encoder_cvbs_remove(priv);
> + if (priv) {
> + meson_encoder_dsi_remove(priv);
> + meson_encoder_hdmi_remove(priv);
> + meson_encoder_cvbs_remove(priv);
> + }
This is the straight-forward approach.
There's been conversions from non-devm_ functions to their devm_*
counterparts in the past in various subsystems.
I just found that there's a devm_drm_dev_alloc() which seems to be
calling drm_dev_put() automatically - but I have never used it myself
before.
As an alternative to your suggested approach: could you please look
into whether devm_drm_dev_alloc() is a suitable replacement (if not:
just explain why - then this patch is good to be merged)?
Thank you!
Martin
Powered by blists - more mailing lists