* [PATCH v1] soc: ti: ti_sci_pm_domains: Check for null return of devm_kcalloc
@ 2022-03-24 7:44 QintaoShen
2022-04-15 20:02 ` Nishanth Menon
0 siblings, 1 reply; 2+ messages in thread
From: QintaoShen @ 2022-03-24 7:44 UTC (permalink / raw)
To: kristo; +Cc: ssantosh, nm, linux-kernel, QintaoShen
The allocation funciton devm_kcalloc may fail and return a null pointer,
which would cause a null-pointer dereference later.
It might be better to check it and directly return -ENOMEM just like the
usage of devm_kcalloc in previous code.
Signed-off-by: QintaoShen <unSimple1993@163.com>
---
drivers/soc/ti/ti_sci_pm_domains.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/soc/ti/ti_sci_pm_domains.c b/drivers/soc/ti/ti_sci_pm_domains.c
index 8afb3f45..a33ec7e 100644
--- a/drivers/soc/ti/ti_sci_pm_domains.c
+++ b/drivers/soc/ti/ti_sci_pm_domains.c
@@ -183,6 +183,8 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev)
devm_kcalloc(dev, max_id + 1,
sizeof(*pd_provider->data.domains),
GFP_KERNEL);
+ if (!pd_provider->data.domains)
+ return -ENOMEM;
pd_provider->data.num_domains = max_id + 1;
pd_provider->data.xlate = ti_sci_pd_xlate;
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v1] soc: ti: ti_sci_pm_domains: Check for null return of devm_kcalloc
2022-03-24 7:44 [PATCH v1] soc: ti: ti_sci_pm_domains: Check for null return of devm_kcalloc QintaoShen
@ 2022-04-15 20:02 ` Nishanth Menon
0 siblings, 0 replies; 2+ messages in thread
From: Nishanth Menon @ 2022-04-15 20:02 UTC (permalink / raw)
To: kristo, QintaoShen; +Cc: Nishanth Menon, linux-kernel, ssantosh, d-gerlach
Hi QintaoShen,
On Thu, 24 Mar 2022 15:44:03 +0800, QintaoShen wrote:
> The allocation funciton devm_kcalloc may fail and return a null pointer,
> which would cause a null-pointer dereference later.
> It might be better to check it and directly return -ENOMEM just like the
> usage of devm_kcalloc in previous code.
>
>
I have applied the following to branch ti-drivers-soc-next on [1].
Thank you!
[1/1] soc: ti: ti_sci_pm_domains: Check for null return of devm_kcalloc
commit: ba56291e297d28aa6eb82c5c1964fae2d7594746
Sidenote: [PATCH] is sufficient for v1 of the patch, it is understood to be
default indexed from 1 ;). Ofcourse, an update of the patch would have been
posted as [PATCH V2] and so on..
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent up the chain during
the next merge window (or sooner if it is a relevant bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
[1] git://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
--
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-15 20:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 7:44 [PATCH v1] soc: ti: ti_sci_pm_domains: Check for null return of devm_kcalloc QintaoShen
2022-04-15 20:02 ` Nishanth Menon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®