summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev
diff options
context:
space:
mode:
authorMayank Chopra <makchopra@codeaurora.org>2013-11-14 17:44:04 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:23:41 -0700
commita103d7e18e73e7ac793dc1ea8a6944a4ea35994d (patch)
tree374e71482520d44ad1dac2bfa57ec79f79ad24b9 /drivers/video/fbdev
parent8ac5b39f9680672b0f2d5965cac41da1b85180fe (diff)
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: Mayank Chopra <makchopra@codeaurora.org>
Diffstat (limited to 'drivers/video/fbdev')
-rw-r--r--drivers/video/fbdev/msm/mdss_dsi_panel.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/video/fbdev/msm/mdss_dsi_panel.c b/drivers/video/fbdev/msm/mdss_dsi_panel.c
index 112c0ef28f46..379c64a81d36 100644
--- a/drivers/video/fbdev/msm/mdss_dsi_panel.c
+++ b/drivers/video/fbdev/msm/mdss_dsi_panel.c
@@ -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 (strlen(pdest) != 9) {
- pr_err("%s: Unknown pdest specified\n", __func__);
+ if (pdest) {
+ if (strlen(pdest) != 9) {
+ pr_err("%s: Unknown pdest specified\n", __func__);
+ return -EINVAL;
+ }
+ if (!strcmp(pdest, "display_1"))
+ pinfo->pdest = DISPLAY_1;
+ 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;
}
- if (!strncmp(pdest, "display_1", 9))
- pinfo->pdest = DISPLAY_1;
- else if (!strncmp(pdest, "display_2", 9))
- pinfo->pdest = DISPLAY_2;
- else {
- pr_debug("%s: pdest not specified. Set Default\n",
- __func__);
- pinfo->pdest = DISPLAY_1;
- }
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);