Re: [PATCH 1/6] crypto: img-hash - Fix null pointer exception

2016-07-12 Thread Herbert Xu
Will Thomas  wrote:
> Sporadic null pointer exceptions came from here. Fix them.
> 
> Signed-off-by: Will Thomas 
> Reviewed-by: James Hartley 
> ---
> drivers/crypto/img-hash.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
> index 68e8aa9..a5f270b 100644
> --- a/drivers/crypto/img-hash.c
> +++ b/drivers/crypto/img-hash.c
> @@ -361,7 +361,7 @@ static void img_hash_dma_task(unsigned long d)
>size_t nbytes, bleft, wsend, len, tbc;
>struct scatterlist tsg;
> 
> -   if (!ctx->sg)
> +   if (!ctx || !ctx->sg)
>return;

This makes no sense.  ctx comes from ahash_request_ctx which can
never be NULL.  Perhaps you meant !hdev->req?

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] crypto: img-hash - Fix null pointer exception

2016-07-11 Thread Will Thomas
Sporadic null pointer exceptions came from here. Fix them.

Signed-off-by: Will Thomas 
Reviewed-by: James Hartley 
---
 drivers/crypto/img-hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
index 68e8aa9..a5f270b 100644
--- a/drivers/crypto/img-hash.c
+++ b/drivers/crypto/img-hash.c
@@ -361,7 +361,7 @@ static void img_hash_dma_task(unsigned long d)
size_t nbytes, bleft, wsend, len, tbc;
struct scatterlist tsg;
 
-   if (!ctx->sg)
+   if (!ctx || !ctx->sg)
return;
 
addr = sg_virt(ctx->sg);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html