drm/msm/dp: add input validation for bpc function
Add input validation to ensure that there is a valid EDID
buffer before attempting to retrieve the panel bpc value.
CRs-Fixed: 2057884
Change-Id: I43a157265dba263908e75bc2b858f522f3302edd
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
diff --git a/drivers/gpu/drm/msm/sde_edid_parser.c b/drivers/gpu/drm/msm/sde_edid_parser.c
index 130bd1f..3eaec26 100644
--- a/drivers/gpu/drm/msm/sde_edid_parser.c
+++ b/drivers/gpu/drm/msm/sde_edid_parser.c
@@ -562,6 +562,11 @@
struct sde_edid_ctrl *edid_ctrl = (struct sde_edid_ctrl *)(input);
struct edid *edid = edid_ctrl->edid;
+ if (!edid) {
+ SDE_ERROR("invalid edid input\n");
+ return 0;
+ }
+
if ((edid->revision < 3) || !(edid->input & DRM_EDID_INPUT_DIGITAL))
return 0;