[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240218221658.131043-1-kilian.zinnecker@mail.de>
Date: Sun, 18 Feb 2024 23:16:58 +0100
From: Kilian Zinnecker <kilian.zinnecker@...l.de>
To: Corentin Labbe <clabbe@...libre.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S . Miller" <davem@...emloft.net>,
Heiko Stuebner <heiko@...ech.de>
Cc: linux-crypto@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Kilian Zinnecker <kilian.zinnecker@...l.de>
Subject: [PATCH] crypto: rockchip - fix to check return value
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@...l.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
Powered by blists - more mailing lists