mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
crypto: img-hash - Fix variable dereferenced before check 'hdev->req'
[ Upstream commit04ba54e5af] Smatch report warning as follows: drivers/crypto/img-hash.c:366 img_hash_dma_task() warn: variable dereferenced before check 'hdev->req' Variable dereferenced should be done after check 'hdev->req', fix it. Fixes:d358f1abbf("crypto: img-hash - Add Imagination Technologies hw hash accelerator") Fixes:10badea259("crypto: img-hash - Fix null pointer exception") Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
15ca148940
commit
38da26c855
@@ -357,12 +357,16 @@ static int img_hash_dma_init(struct img_hash_dev *hdev)
|
|||||||
static void img_hash_dma_task(unsigned long d)
|
static void img_hash_dma_task(unsigned long d)
|
||||||
{
|
{
|
||||||
struct img_hash_dev *hdev = (struct img_hash_dev *)d;
|
struct img_hash_dev *hdev = (struct img_hash_dev *)d;
|
||||||
struct img_hash_request_ctx *ctx = ahash_request_ctx(hdev->req);
|
struct img_hash_request_ctx *ctx;
|
||||||
u8 *addr;
|
u8 *addr;
|
||||||
size_t nbytes, bleft, wsend, len, tbc;
|
size_t nbytes, bleft, wsend, len, tbc;
|
||||||
struct scatterlist tsg;
|
struct scatterlist tsg;
|
||||||
|
|
||||||
if (!hdev->req || !ctx->sg)
|
if (!hdev->req)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ctx = ahash_request_ctx(hdev->req);
|
||||||
|
if (!ctx->sg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
addr = sg_virt(ctx->sg);
|
addr = sg_virt(ctx->sg);
|
||||||
|
|||||||
Reference in New Issue
Block a user