Commit 297717d4 authored by Stephen Kitt's avatar Stephen Kitt Committed by Greg Kroah-Hartman

clk/ti/adpll: allocate room for terminating null

[ Upstream commit 7f6ac729 ]

The buffer allocated in ti_adpll_clk_get_name doesn't account for the
terminating null. This patch switches to devm_kasprintf to avoid
overflowing.
Signed-off-by: default avatarStephen Kitt <steve@sk2.org>
Link: https://lkml.kernel.org/r/20191019140634.15596-1-steve@sk2.orgAcked-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 08f4fc4c
...@@ -193,15 +193,8 @@ static const char *ti_adpll_clk_get_name(struct ti_adpll_data *d, ...@@ -193,15 +193,8 @@ static const char *ti_adpll_clk_get_name(struct ti_adpll_data *d,
if (err) if (err)
return NULL; return NULL;
} else { } else {
const char *base_name = "adpll"; name = devm_kasprintf(d->dev, GFP_KERNEL, "%08lx.adpll.%s",
char *buf; d->pa, postfix);
buf = devm_kzalloc(d->dev, 8 + 1 + strlen(base_name) + 1 +
strlen(postfix), GFP_KERNEL);
if (!buf)
return NULL;
sprintf(buf, "%08lx.%s.%s", d->pa, base_name, postfix);
name = buf;
} }
return name; return name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment