[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d60f663a-c986-4076-736b-05d50e4aefc0@linaro.org>
Date: Tue, 25 Jan 2022 05:00:18 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: José Expósito <jose.exposito89@...il.com>,
hali@...eaurora.org
Cc: robdclark@...il.com, sean@...rly.run, airlied@...ux.ie,
daniel@...ll.ch, abhinavk@...eaurora.org, rajeevny@...eaurora.org,
linux-arm-msm@...r.kernel.org, dri-devel@...ts.freedesktop.org,
freedreno@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/msm/dsi: invalid parameter check in
msm_dsi_phy_enable
On 16/01/2022 21:18, José Expósito wrote:
> The function performs a check on the "phy" input parameter, however, it
> is used before the check.
>
> Initialize the "dev" variable after the sanity check to avoid a possible
> NULL pointer dereference.
>
> Fixes: 5c8290284402b ("drm/msm/dsi: Split PHY drivers to separate files")
> Addresses-Coverity-ID: 1493860 ("Null pointer dereference")
> Signed-off-by: José Expósito <jose.exposito89@...il.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> ---
> drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
> index 9842e04b5858..baa6af0c3bcc 100644
> --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
> +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
> @@ -808,12 +808,14 @@ int msm_dsi_phy_enable(struct msm_dsi_phy *phy,
> struct msm_dsi_phy_clk_request *clk_req,
> struct msm_dsi_phy_shared_timings *shared_timings)
> {
> - struct device *dev = &phy->pdev->dev;
> + struct device *dev;
> int ret;
>
> if (!phy || !phy->cfg->ops.enable)
> return -EINVAL;
>
> + dev = &phy->pdev->dev;
> +
> ret = dsi_phy_enable_resource(phy);
> if (ret) {
> DRM_DEV_ERROR(dev, "%s: resource enable failed, %d\n",
--
With best wishes
Dmitry
Powered by blists - more mailing lists