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

Commit 09dc7ecd authored by Mayank Chopra's avatar Mayank Chopra
Browse files

msm: mdss: Sanitize read of panel properties



Check panel property's values properly before operating on
them.

CRs-Fixed: 562887
Change-Id: I26ce51e8b3a8e9328e7b6370b9c56d67fcdd1901
Signed-off-by: default avatarMayank Chopra <makchopra@codeaurora.org>
parent bcb87d5a
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -485,7 +485,7 @@ static int mdss_dsi_parse_dcs_cmds(struct device_node *np,
	}

	data = of_get_property(np, link_key, NULL);
	if (!strncmp(data, "dsi_hs_mode", 11))
	if (data && !strcmp(data, "dsi_hs_mode"))
		pcmds->link_state = DSI_HS_MODE;
	else
		pcmds->link_state = DSI_LP_MODE;
@@ -756,19 +756,24 @@ static int mdss_panel_parse_dt(struct device_node *np,
	pdest = of_get_property(np,
		"qcom,mdss-dsi-panel-destination", NULL);

	if (pdest) {
		if (strlen(pdest) != 9) {
			pr_err("%s: Unknown pdest specified\n", __func__);
			return -EINVAL;
		}
	if (!strncmp(pdest, "display_1", 9))
		if (!strcmp(pdest, "display_1"))
			pinfo->pdest = DISPLAY_1;
	else if (!strncmp(pdest, "display_2", 9))
		else if (!strcmp(pdest, "display_2"))
			pinfo->pdest = DISPLAY_2;
		else {
			pr_debug("%s: pdest not specified. Set Default\n",
								__func__);
			pinfo->pdest = DISPLAY_1;
		}
	} else {
		pr_err("%s: pdest not specified\n", __func__);
		return -EINVAL;
	}
	rc = of_property_read_u32(np, "qcom,mdss-dsi-h-front-porch", &tmp);
	pinfo->lcdc.h_front_porch = (!rc ? tmp : 6);
	rc = of_property_read_u32(np, "qcom,mdss-dsi-h-back-porch", &tmp);