Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f302be08 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman
Browse files

drm/msm: Fix null pointer dereference on pointer edp



commit 2133c4fc8e1348dcb752f267a143fe2254613b34 upstream.

The initialization of pointer dev dereferences pointer edp before
edp is null checked, so there is a potential null pointer deference
issue. Fix this by only dereferencing edp after edp has been null
checked.

Addresses-Coverity: ("Dereference before null check")
Fixes: ab5b0107 ("drm/msm: Initial add eDP support in msm drm driver (v5)")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20210929121857.213922-1-colin.king@canonical.com


Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0d5ef1e8
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1082,7 +1082,7 @@ void msm_edp_ctrl_power(struct edp_ctrl *ctrl, bool on)
int msm_edp_ctrl_init(struct msm_edp *edp)
int msm_edp_ctrl_init(struct msm_edp *edp)
{
{
	struct edp_ctrl *ctrl = NULL;
	struct edp_ctrl *ctrl = NULL;
	struct device *dev = &edp->pdev->dev;
	struct device *dev;
	int ret;
	int ret;


	if (!edp) {
	if (!edp) {
@@ -1090,6 +1090,7 @@ int msm_edp_ctrl_init(struct msm_edp *edp)
		return -EINVAL;
		return -EINVAL;
	}
	}


	dev = &edp->pdev->dev;
	ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL);
	ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL);
	if (!ctrl)
	if (!ctrl)
		return -ENOMEM;
		return -ENOMEM;