* [PATCH] drm/msm/dsi: invalid parameter check in msm_dsi_phy_enable
@ 2022-01-16 18:18 José Expósito
2022-01-25 2:00 ` Dmitry Baryshkov
0 siblings, 1 reply; 2+ messages in thread
From: José Expósito @ 2022-01-16 18:18 UTC (permalink / raw)
To: hali
Cc: robdclark, sean, airlied, daniel, dmitry.baryshkov, abhinavk,
rajeevny, linux-arm-msm, dri-devel, freedreno, linux-kernel,
José Expósito
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>
---
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",
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/msm/dsi: invalid parameter check in msm_dsi_phy_enable
2022-01-16 18:18 [PATCH] drm/msm/dsi: invalid parameter check in msm_dsi_phy_enable José Expósito
@ 2022-01-25 2:00 ` Dmitry Baryshkov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Baryshkov @ 2022-01-25 2:00 UTC (permalink / raw)
To: José Expósito, hali
Cc: robdclark, sean, airlied, daniel, abhinavk, rajeevny,
linux-arm-msm, dri-devel, freedreno, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-25 3:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-16 18:18 [PATCH] drm/msm/dsi: invalid parameter check in msm_dsi_phy_enable José Expósito
2022-01-25 2:00 ` Dmitry Baryshkov
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®