Skip to content

Commit a24e3b5

Browse files
kilian-zinnecker2herbertx
authored andcommitted
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@mail.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent e63df1e commit a24e3b5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/crypto/rockchip/rk3288_crypto.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ static int rk_crypto_probe(struct platform_device *pdev)
371371
}
372372

373373
crypto_info->engine = crypto_engine_alloc_init(&pdev->dev, true);
374+
if (!crypto_info->engine) {
375+
err = -ENOMEM;
376+
goto err_crypto;
377+
}
378+
374379
crypto_engine_start(crypto_info->engine);
375380
init_completion(&crypto_info->complete);
376381

0 commit comments

Comments
 (0)