* [PATCH -next] coresight: Fix incorrect handling for return value of devm_kzalloc
@ 2025-09-08 12:20 Lin Yujun
2025-09-08 12:38 ` James Clark
2025-09-10 16:26 ` Suzuki K Poulose
0 siblings, 2 replies; 3+ messages in thread
From: Lin Yujun @ 2025-09-08 12:20 UTC (permalink / raw)
To: suzuki.poulose, mike.leach, james.clark, alexander.shishkin,
anshuman.khandual
Cc: linux-kernel
The return value of devm_kzalloc could be an null pointer,
use "!desc.pdata" to fix incorrect handling return value
of devm_kzalloc.
Fixes: 4277f035d227 ("coresight: trbe: Add a representative coresight_platform_data for TRBE")
Signed-off-by: Lin Yujun <linyujun809@h-partners.com>
---
drivers/hwtracing/coresight/coresight-trbe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
index 8267dd1a2130..caf873adfc3a 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -1277,11 +1277,11 @@ static void arm_trbe_register_coresight_cpu(struct trbe_drvdata *drvdata, int cp
* ends up failing. Instead let's allocate a dummy zeroed
* coresight_platform_data structure and assign that back
* into the device for that purpose.
*/
desc.pdata = devm_kzalloc(dev, sizeof(*desc.pdata), GFP_KERNEL);
- if (IS_ERR(desc.pdata))
+ if (!desc.pdata)
goto cpu_clear;
desc.type = CORESIGHT_DEV_TYPE_SINK;
desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_PERCPU_SYSMEM;
desc.ops = &arm_trbe_cs_ops;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] coresight: Fix incorrect handling for return value of devm_kzalloc
2025-09-08 12:20 [PATCH -next] coresight: Fix incorrect handling for return value of devm_kzalloc Lin Yujun
@ 2025-09-08 12:38 ` James Clark
2025-09-10 16:26 ` Suzuki K Poulose
1 sibling, 0 replies; 3+ messages in thread
From: James Clark @ 2025-09-08 12:38 UTC (permalink / raw)
To: Lin Yujun, suzuki.poulose
Cc: linux-kernel, coresight@lists.linaro.org, mike.leach,
alexander.shishkin, anshuman.khandual, Leo Yan
On 08/09/2025 1:20 pm, Lin Yujun wrote:
> The return value of devm_kzalloc could be an null pointer,
> use "!desc.pdata" to fix incorrect handling return value
> of devm_kzalloc.
>
> Fixes: 4277f035d227 ("coresight: trbe: Add a representative coresight_platform_data for TRBE")
> Signed-off-by: Lin Yujun <linyujun809@h-partners.com>
> ---
> drivers/hwtracing/coresight/coresight-trbe.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
> index 8267dd1a2130..caf873adfc3a 100644
> --- a/drivers/hwtracing/coresight/coresight-trbe.c
> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
> @@ -1277,11 +1277,11 @@ static void arm_trbe_register_coresight_cpu(struct trbe_drvdata *drvdata, int cp
> * ends up failing. Instead let's allocate a dummy zeroed
> * coresight_platform_data structure and assign that back
> * into the device for that purpose.
> */
> desc.pdata = devm_kzalloc(dev, sizeof(*desc.pdata), GFP_KERNEL);
> - if (IS_ERR(desc.pdata))
> + if (!desc.pdata)
> goto cpu_clear;
>
> desc.type = CORESIGHT_DEV_TYPE_SINK;
> desc.subtype.sink_subtype = CORESIGHT_DEV_SUBTYPE_SINK_PERCPU_SYSMEM;
> desc.ops = &arm_trbe_cs_ops;
Reviewed-by: James Clark <james.clark@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] coresight: Fix incorrect handling for return value of devm_kzalloc
2025-09-08 12:20 [PATCH -next] coresight: Fix incorrect handling for return value of devm_kzalloc Lin Yujun
2025-09-08 12:38 ` James Clark
@ 2025-09-10 16:26 ` Suzuki K Poulose
1 sibling, 0 replies; 3+ messages in thread
From: Suzuki K Poulose @ 2025-09-10 16:26 UTC (permalink / raw)
To: mike.leach, james.clark, alexander.shishkin, anshuman.khandual,
Lin Yujun
Cc: Suzuki K Poulose, linux-kernel
On Mon, 08 Sep 2025 20:20:22 +0800, Lin Yujun wrote:
> The return value of devm_kzalloc could be an null pointer,
> use "!desc.pdata" to fix incorrect handling return value
> of devm_kzalloc.
>
>
Applied, thanks!
[1/1] coresight: Fix incorrect handling for return value of devm_kzalloc
https://git.kernel.org/coresight/c/6292413be002
Best regards,
--
Suzuki K Poulose <suzuki.poulose@arm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-10 16:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08 12:20 [PATCH -next] coresight: Fix incorrect handling for return value of devm_kzalloc Lin Yujun
2025-09-08 12:38 ` James Clark
2025-09-10 16:26 ` Suzuki K Poulose
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox