Commit fb1dd794 authored by Syam Sidhardhan's avatar Syam Sidhardhan Committed by Herbert Xu

crypto: bfin_crc - Fix possible NULL pointer dereference

If we define dev_dbg(), then there is a possible NULL pointer
dereference.
Signed-off-by: default avatarSyam Sidhardhan <s.syam@samsung.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent a84fb791
...@@ -151,7 +151,7 @@ static int bfin_crypto_crc_init(struct ahash_request *req) ...@@ -151,7 +151,7 @@ static int bfin_crypto_crc_init(struct ahash_request *req)
struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req); struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req);
struct bfin_crypto_crc *crc; struct bfin_crypto_crc *crc;
dev_dbg(crc->dev, "crc_init\n"); dev_dbg(ctx->crc->dev, "crc_init\n");
spin_lock_bh(&crc_list.lock); spin_lock_bh(&crc_list.lock);
list_for_each_entry(crc, &crc_list.dev_list, list) { list_for_each_entry(crc, &crc_list.dev_list, list) {
crc_ctx->crc = crc; crc_ctx->crc = crc;
...@@ -160,7 +160,7 @@ static int bfin_crypto_crc_init(struct ahash_request *req) ...@@ -160,7 +160,7 @@ static int bfin_crypto_crc_init(struct ahash_request *req)
spin_unlock_bh(&crc_list.lock); spin_unlock_bh(&crc_list.lock);
if (sg_count(req->src) > CRC_MAX_DMA_DESC) { if (sg_count(req->src) > CRC_MAX_DMA_DESC) {
dev_dbg(crc->dev, "init: requested sg list is too big > %d\n", dev_dbg(ctx->crc->dev, "init: requested sg list is too big > %d\n",
CRC_MAX_DMA_DESC); CRC_MAX_DMA_DESC);
return -EINVAL; return -EINVAL;
} }
...@@ -175,7 +175,7 @@ static int bfin_crypto_crc_init(struct ahash_request *req) ...@@ -175,7 +175,7 @@ static int bfin_crypto_crc_init(struct ahash_request *req)
/* init crc results */ /* init crc results */
put_unaligned_le32(crc_ctx->key, req->result); put_unaligned_le32(crc_ctx->key, req->result);
dev_dbg(crc->dev, "init: digest size: %d\n", dev_dbg(ctx->crc->dev, "init: digest size: %d\n",
crypto_ahash_digestsize(tfm)); crypto_ahash_digestsize(tfm));
return bfin_crypto_crc_init_hw(crc, crc_ctx->key); return bfin_crypto_crc_init_hw(crc, crc_ctx->key);
......
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