Commit a1862c3b authored by Neal Liu's avatar Neal Liu Committed by Herbert Xu

crypto: aspeed - add error handling if dmam_alloc_coherent() failed

Since the acry_dev->buf_addr may be NULL, add error handling to
prevent any additional access to avoid potential issues.
Signed-off-by: default avatarNeal Liu <neal_liu@aspeedtech.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent f84155ca
......@@ -779,7 +779,10 @@ static int aspeed_acry_probe(struct platform_device *pdev)
acry_dev->buf_addr = dmam_alloc_coherent(dev, ASPEED_ACRY_BUFF_SIZE,
&acry_dev->buf_dma_addr,
GFP_KERNEL);
memzero_explicit(acry_dev->buf_addr, ASPEED_ACRY_BUFF_SIZE);
if (!acry_dev->buf_addr) {
rc = -ENOMEM;
goto err_engine_rsa_start;
}
aspeed_acry_register(acry_dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment