msm: mdss: Initialize pan_name array to 0 and handle error case
Initialize the pan_name array to 0 before trying to copy data from mdss_mdp_panel array to prevent junk values being wrongly parsed by strnstr function and return error when panel name is '0', this would let us read the primary panel interface from device tree. Change-Id: I07bfc1f7195f6cc61dfd3e470d2e3e3e43c0049d Signed-off-by: Shalini Krishnamoorthi <shakri@codeaurora.org> Signed-off-by: Krishna Manikandan <mkrishn@codeaurora.org>
This commit is contained in:
parent
64f1b2153f
commit
cb31d17385
1 changed files with 5 additions and 2 deletions
|
@ -2416,13 +2416,16 @@ static int mdss_mdp_get_pan_cfg(struct mdss_panel_cfg *pan_cfg)
|
|||
char *t = NULL;
|
||||
char pan_intf_str[MDSS_MAX_PANEL_LEN];
|
||||
int rc, i, panel_len;
|
||||
char pan_name[MDSS_MAX_PANEL_LEN];
|
||||
char pan_name[MDSS_MAX_PANEL_LEN] = {'\0'};
|
||||
|
||||
if (!pan_cfg)
|
||||
return -EINVAL;
|
||||
|
||||
if (mdss_mdp_panel[0] == '0') {
|
||||
pr_debug("panel name is not set\n");
|
||||
pan_cfg->lk_cfg = false;
|
||||
pan_cfg->pan_intf = MDSS_PANEL_INTF_INVALID;
|
||||
return -EINVAL;
|
||||
} else if (mdss_mdp_panel[0] == '1') {
|
||||
pan_cfg->lk_cfg = true;
|
||||
} else {
|
||||
|
@ -2432,7 +2435,7 @@ static int mdss_mdp_get_pan_cfg(struct mdss_panel_cfg *pan_cfg)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* skip lk cfg and delimiter; ex: "0:" */
|
||||
/* skip lk cfg and delimiter; ex: "1:" */
|
||||
strlcpy(pan_name, &mdss_mdp_panel[2], MDSS_MAX_PANEL_LEN);
|
||||
t = strnstr(pan_name, ":", MDSS_MAX_PANEL_LEN);
|
||||
if (!t) {
|
||||
|
|
Loading…
Add table
Reference in a new issue