* [PATCH] firmware: qcom_scm: Fix coccinelle warning
@ 2026-02-02 11:32 Mukesh Ojha
2026-02-02 11:51 ` Konrad Dybcio
0 siblings, 1 reply; 4+ messages in thread
From: Mukesh Ojha @ 2026-02-02 11:32 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, Mukesh Ojha, kernel test robot
Fix coccinelle warning of allocation and memory copying to allocated
memory by replacing with kmemdup.
cocci warnings: (new ones prefixed by >>)
>> drivers/firmware/qcom/qcom_scm.c:916:11-18: WARNING opportunity for kmemdup
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202601142144.HvSlBSI9-lkp@intel.com/
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
Exact patch where this warning introduced is in Linux-next but not yet
hit stable.
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 8fbc96693a55..d439a9f5b62b 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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] firmware: qcom_scm: Fix coccinelle warning
2026-02-02 11:32 [PATCH] firmware: qcom_scm: Fix coccinelle warning Mukesh Ojha
@ 2026-02-02 11:51 ` Konrad Dybcio
2026-02-05 8:23 ` Mukesh Ojha
0 siblings, 1 reply; 4+ messages in thread
From: Konrad Dybcio @ 2026-02-02 11:51 UTC (permalink / raw)
To: Mukesh Ojha, Bjorn Andersson, Konrad Dybcio
Cc: linux-arm-msm, linux-kernel, kernel test robot
On 2/2/26 12:32 PM, Mukesh Ojha wrote:
> Fix coccinelle warning of allocation and memory copying to allocated
> memory by replacing with kmemdup.
>
> cocci warnings: (new ones prefixed by >>)
>>> drivers/firmware/qcom/qcom_scm.c:916:11-18: WARNING opportunity for kmemdup
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202601142144.HvSlBSI9-lkp@intel.com/
> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> ---
Preferably the subject would say something like 'don't opencode kmemdup',
but that's minor
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Konrad
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: qcom_scm: Fix coccinelle warning
2026-02-02 11:51 ` Konrad Dybcio
@ 2026-02-05 8:23 ` Mukesh Ojha
2026-02-05 11:04 ` Konrad Dybcio
0 siblings, 1 reply; 4+ messages in thread
From: Mukesh Ojha @ 2026-02-05 8:23 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Konrad Dybcio, linux-arm-msm, linux-kernel,
kernel test robot
On Mon, Feb 02, 2026 at 12:51:31PM +0100, Konrad Dybcio wrote:
> On 2/2/26 12:32 PM, Mukesh Ojha wrote:
> > Fix coccinelle warning of allocation and memory copying to allocated
> > memory by replacing with kmemdup.
> >
> > cocci warnings: (new ones prefixed by >>)
> >>> drivers/firmware/qcom/qcom_scm.c:916:11-18: WARNING opportunity for kmemdup
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202601142144.HvSlBSI9-lkp@intel.com/
> > Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> > ---
>
> Preferably the subject would say something like 'don't opencode kmemdup',
> but that's minor
Thanks, Just checking if the tool name like coccinelle, smatch, sparse
who may find some issue is not preferrable to get mentioned in commit at all ?
>
> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> Konrad
--
-Mukesh Ojha
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: qcom_scm: Fix coccinelle warning
2026-02-05 8:23 ` Mukesh Ojha
@ 2026-02-05 11:04 ` Konrad Dybcio
0 siblings, 0 replies; 4+ messages in thread
From: Konrad Dybcio @ 2026-02-05 11:04 UTC (permalink / raw)
To: Mukesh Ojha
Cc: Bjorn Andersson, Konrad Dybcio, linux-arm-msm, linux-kernel,
kernel test robot
On 2/5/26 9:23 AM, Mukesh Ojha wrote:
> On Mon, Feb 02, 2026 at 12:51:31PM +0100, Konrad Dybcio wrote:
>> On 2/2/26 12:32 PM, Mukesh Ojha wrote:
>>> Fix coccinelle warning of allocation and memory copying to allocated
>>> memory by replacing with kmemdup.
>>>
>>> cocci warnings: (new ones prefixed by >>)
>>>>> drivers/firmware/qcom/qcom_scm.c:916:11-18: WARNING opportunity for kmemdup
>>>
>>> Reported-by: kernel test robot <lkp@intel.com>
>>> Closes: https://lore.kernel.org/oe-kbuild-all/202601142144.HvSlBSI9-lkp@intel.com/
>>> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
>>> ---
>>
>> Preferably the subject would say something like 'don't opencode kmemdup',
>> but that's minor
>
> Thanks, Just checking if the tool name like coccinelle, smatch, sparse
> who may find some issue is not preferrable to get mentioned in commit at all ?
I think it's even required to mention it somewhere in the message..
I can't find the actual reference, but Greg said this last week:
https://lore.kernel.org/linux-arm-msm/2026012748-unblock-vacation-70b8@gregkh/
Konrad
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-05 11:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-02 11:32 [PATCH] firmware: qcom_scm: Fix coccinelle warning Mukesh Ojha
2026-02-02 11:51 ` Konrad Dybcio
2026-02-05 8:23 ` Mukesh Ojha
2026-02-05 11:04 ` Konrad Dybcio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox