* [PATCH] crypto: rockchip - fix to check return value
@ 2024-02-18 22:16 Kilian Zinnecker
2024-02-24 0:52 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Kilian Zinnecker @ 2024-02-18 22:16 UTC (permalink / raw)
To: Corentin Labbe, Herbert Xu, David S . Miller, Heiko Stuebner
Cc: linux-crypto, linux-arm-kernel, linux-rockchip, linux-kernel,
Kilian Zinnecker
crypto_engine_alloc_init may fail, e.g., as result of a fail of
devm_kzalloc or kthread_create_worker. Other drivers (e.g.,
amlogic-gxl-core.c, aspeed-acry.c, aspeed-hace.c, jr.c, etc.) check
crypto_engine_alloc_init's return value and return -ENOMEM in case
a NULL pointer is returned. This patch inserts a corresponding
return value check to rk3288_crypto.c.
Signed-off-by: Kilian Zinnecker <kilian.zinnecker@mail.de>
---
drivers/crypto/rockchip/rk3288_crypto.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c
index 70edf40bc523..f74b3c81ba6d 100644
--- a/drivers/crypto/rockchip/rk3288_crypto.c
+++ b/drivers/crypto/rockchip/rk3288_crypto.c
@@ -371,6 +371,11 @@ static int rk_crypto_probe(struct platform_device *pdev)
}
crypto_info->engine = crypto_engine_alloc_init(&pdev->dev, true);
+ if (!crypto_info->engine) {
+ err = -ENOMEM;
+ goto err_crypto;
+ }
+
crypto_engine_start(crypto_info->engine);
init_completion(&crypto_info->complete);
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] crypto: rockchip - fix to check return value
2024-02-18 22:16 [PATCH] crypto: rockchip - fix to check return value Kilian Zinnecker
@ 2024-02-24 0:52 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2024-02-24 0:52 UTC (permalink / raw)
To: Kilian Zinnecker
Cc: Corentin Labbe, David S . Miller, Heiko Stuebner, linux-crypto,
linux-arm-kernel, linux-rockchip, linux-kernel
On Sun, Feb 18, 2024 at 11:16:58PM +0100, Kilian Zinnecker wrote:
> crypto_engine_alloc_init may fail, e.g., as result of a fail of
> devm_kzalloc or kthread_create_worker. Other drivers (e.g.,
> amlogic-gxl-core.c, aspeed-acry.c, aspeed-hace.c, jr.c, etc.) check
> crypto_engine_alloc_init's return value and return -ENOMEM in case
> a NULL pointer is returned. This patch inserts a corresponding
> return value check to rk3288_crypto.c.
>
> Signed-off-by: Kilian Zinnecker <kilian.zinnecker@mail.de>
> ---
> drivers/crypto/rockchip/rk3288_crypto.c | 5 +++++
> 1 file changed, 5 insertions(+)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-24 0:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-18 22:16 [PATCH] crypto: rockchip - fix to check return value Kilian Zinnecker
2024-02-24 0:52 ` Herbert Xu
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®