summaryrefslogtreecommitdiff
path: root/drivers/firmware/arm_scmi/perf.c
diff options
context:
space:
mode:
authorSudeep Holla <sudeep.holla@arm.com>2018-09-07 19:03:25 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-20 20:46:14 +0300
commit4c884128b414e02dad5be3cc510f00215fe64a3e (patch)
treee4121f9c11862e52dbf0e77946d0ea5f1f8124c0 /drivers/firmware/arm_scmi/perf.c
parentd786bf93f0c5200296559e878972afc2ea40212d (diff)
downloadlinux-4c884128b414e02dad5be3cc510f00215fe64a3e.tar.xz
firmware: arm_scmi: use strlcpy to ensure NULL-terminated strings
[ Upstream commit ca64b719a1e665ac7449b6a968059176af7365a8 ] Replace all the memcpy() for copying name strings from the firmware with strlcpy() to make sure we are bounded by the source buffer size and we also always have NULL-terminated strings. This is needed to avoid out of bounds accesses if the firmware returns a non-terminated string. Reported-by: Olof Johansson <olof@lixom.net> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/firmware/arm_scmi/perf.c')
-rw-r--r--drivers/firmware/arm_scmi/perf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 64342944d917..87c99d296ecd 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -174,7 +174,7 @@ scmi_perf_domain_attributes_get(const struct scmi_handle *handle, u32 domain,
dom_info->mult_factor =
(dom_info->sustained_freq_khz * 1000) /
dom_info->sustained_perf_level;
- memcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
+ strlcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
}
scmi_xfer_put(handle, t);