From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: "José Expósito" <jose.exposito89@gmail.com>, hali@codeaurora.org
Cc: robdclark@gmail.com, sean@poorly.run, airlied@linux.ie,
daniel@ffwll.ch, abhinavk@codeaurora.org,
rajeevny@codeaurora.org, linux-arm-msm@vger.kernel.org,
dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/msm/dsi: invalid parameter check in msm_dsi_phy_enable
Date: Tue, 25 Jan 2022 05:00:18 +0300 [thread overview]
Message-ID: <d60f663a-c986-4076-736b-05d50e4aefc0@linaro.org> (raw)
In-Reply-To: <20220116181844.7400-1-jose.exposito89@gmail.com>
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@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.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
prev parent reply other threads:[~2022-01-25 3:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-16 18:18 José Expósito
2022-01-25 2:00 ` Dmitry Baryshkov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d60f663a-c986-4076-736b-05d50e4aefc0@linaro.org \
--to=dmitry.baryshkov@linaro.org \
--cc=abhinavk@codeaurora.org \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=hali@codeaurora.org \
--cc=jose.exposito89@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rajeevny@codeaurora.org \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®