[PATCH 1/1] drm/msm/mdp4: avoid possible null pointer dereference

Heinrich Schuchardt xypron.glpk at gmx.de
Wed May 18 21:06:10 UTC 2016


Do not dereference pll_rate before checking if it is NULL.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_pll.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_pll.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_pll.c
index ce42459..bd10ffe 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_pll.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_pll.c
@@ -72,11 +72,11 @@ static int mpd4_lvds_pll_enable(struct clk_hw *hw)
 	const struct pll_rate *pll_rate = find_rate(lvds_pll->pixclk);
 	int i;
 
-	DBG("pixclk=%lu (%lu)", lvds_pll->pixclk, pll_rate->rate);
-
 	if (WARN_ON(!pll_rate))
 		return -EINVAL;
 
+	DBG("pixclk=%lu (%lu)", lvds_pll->pixclk, pll_rate->rate);
+
 	mdp4_write(mdp4_kms, REG_MDP4_LCDC_LVDS_PHY_RESET, 0x33);
 
 	for (i = 0; pll_rate->conf[i].reg; i++)
-- 
2.1.4



More information about the dri-devel mailing list