aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc
diff options
context:
space:
mode:
authorMukesh Ojha <quic_mojha@quicinc.com>2023-02-14 19:38:11 +0530
committerBjorn Andersson <andersson@kernel.org>2023-02-14 08:21:01 -0800
commit9d5b9ad97f83b2390a6006eeb5ae5e48ec4298ce (patch)
treed0c0760a1eca14bec9fe14aca79dcd3a0fe0060d /drivers/remoteproc
parent640587182066f75d3e8b62522685041f00ffbbbb (diff)
downloadlinux-9d5b9ad97f83b2390a6006eeb5ae5e48ec4298ce.tar.gz
remoteproc: qcom: replace kstrdup with kstrndup
Since, there is no guarantee that region.name will be 0-terminated from the firmware side, replace kstrdup with kstrndup. Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/1676383691-29738-1-git-send-email-quic_mojha@quicinc.com
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r--drivers/remoteproc/qcom_common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index 020349f8979d8..7810f91d3080a 100644
--- a/drivers/remoteproc/qcom_common.c
+++ b/drivers/remoteproc/qcom_common.c
@@ -124,7 +124,7 @@ static int qcom_add_minidump_segments(struct rproc *rproc, struct minidump_subsy
for (i = 0; i < seg_cnt; i++) {
memcpy_fromio(&region, ptr + i, sizeof(region));
if (region.valid == MD_REGION_VALID) {
- name = kstrdup(region.name, GFP_KERNEL);
+ name = kstrndup(region.name, MAX_REGION_NAME_LENGTH - 1, GFP_KERNEL);
if (!name) {
iounmap(ptr);
return -ENOMEM;