drivers/firmware/qcom/qcom_scm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Lets not opencode kmemdup which is reported by coccinelle tool.
Fix it using kmemdup.
cocci warnings: (new ones prefixed by >>)
>> drivers/firmware/qcom/qcom_scm.c:916:11-18: WARNING opportunity for kmemdup
Fixes: 8b9d2050cfa0 ("firmware: qcom_scm: Add qcom_scm_pas_get_rsc_table() to get resource table")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202601142144.HvSlBSI9-lkp@intel.com/
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
changes in v2: https://lore.kernel.org/lkml/3153e8dc-f43e-42fe-b2a3-9cc4806634e1@oss.qualcomm.com/
- Added fixes tag.
- Removed coccinelle from the Subject.
drivers/firmware/qcom/qcom_scm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
index 2fe1632f06e9..dda6b0bc1cbd 100644
--- a/drivers/firmware/qcom/qcom_scm.c
+++ b/drivers/firmware/qcom/qcom_scm.c
@@ -923,14 +923,13 @@ struct resource_table *qcom_scm_pas_get_rsc_table(struct qcom_scm_pas_context *c
goto free_input_rt;
}
- tbl_ptr = kzalloc(size, GFP_KERNEL);
+ tbl_ptr = kmemdup(output_rt_tzm, size, GFP_KERNEL);
if (!tbl_ptr) {
qcom_tzmem_free(output_rt_tzm);
ret = -ENOMEM;
goto free_input_rt;
}
- memcpy(tbl_ptr, output_rt_tzm, size);
*output_rt_size = size;
qcom_tzmem_free(output_rt_tzm);
--
2.50.1
On Tue, 10 Mar 2026 19:32:55 +0530, Mukesh Ojha wrote:
> Lets not opencode kmemdup which is reported by coccinelle tool.
> Fix it using kmemdup.
>
> cocci warnings: (new ones prefixed by >>)
> >> drivers/firmware/qcom/qcom_scm.c:916:11-18: WARNING opportunity for kmemdup
>
>
> [...]
Applied, thanks!
[1/1] firmware: qcom_scm: don't opencode kmemdup
commit: e32701726c0e6312aabd83aa1c00f59b0d7df276
Best regards,
--
Bjorn Andersson <andersson@kernel.org>
© 2016 - 2026 Red Hat, Inc.