aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/bfin_crc.c
diff options
context:
space:
mode:
authorSyam Sidhardhan <syamsidhardh@gmail.com>2013-02-24 17:27:39 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2013-03-10 04:46:43 -0400
commitfb1dd794802022f4413d36e47bd40f8c7bacd456 (patch)
tree632d7f4c6f10d054719bdd34c2ae51c4d6fd54cf /drivers/crypto/bfin_crc.c
parenta84fb791cb467851772a9196c05531be4abaf1bb (diff)
crypto: bfin_crc - Fix possible NULL pointer dereference
If we define dev_dbg(), then there is a possible NULL pointer dereference. Signed-off-by: Syam Sidhardhan <s.syam@samsung.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/bfin_crc.c')
-rw-r--r--drivers/crypto/bfin_crc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/crypto/bfin_crc.c b/drivers/crypto/bfin_crc.c
index 827913d7d33a..d797f31f5d85 100644
--- a/drivers/crypto/bfin_crc.c
+++ b/drivers/crypto/bfin_crc.c
@@ -151,7 +151,7 @@ static int bfin_crypto_crc_init(struct ahash_request *req)
151 struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req); 151 struct bfin_crypto_crc_reqctx *ctx = ahash_request_ctx(req);
152 struct bfin_crypto_crc *crc; 152 struct bfin_crypto_crc *crc;
153 153
154 dev_dbg(crc->dev, "crc_init\n"); 154 dev_dbg(ctx->crc->dev, "crc_init\n");
155 spin_lock_bh(&crc_list.lock); 155 spin_lock_bh(&crc_list.lock);
156 list_for_each_entry(crc, &crc_list.dev_list, list) { 156 list_for_each_entry(crc, &crc_list.dev_list, list) {
157 crc_ctx->crc = crc; 157 crc_ctx->crc = crc;
@@ -160,7 +160,7 @@ static int bfin_crypto_crc_init(struct ahash_request *req)
160 spin_unlock_bh(&crc_list.lock); 160 spin_unlock_bh(&crc_list.lock);
161 161
162 if (sg_count(req->src) > CRC_MAX_DMA_DESC) { 162 if (sg_count(req->src) > CRC_MAX_DMA_DESC) {
163 dev_dbg(crc->dev, "init: requested sg list is too big > %d\n", 163 dev_dbg(ctx->crc->dev, "init: requested sg list is too big > %d\n",
164 CRC_MAX_DMA_DESC); 164 CRC_MAX_DMA_DESC);
165 return -EINVAL; 165 return -EINVAL;
166 } 166 }
@@ -175,7 +175,7 @@ static int bfin_crypto_crc_init(struct ahash_request *req)
175 /* init crc results */ 175 /* init crc results */
176 put_unaligned_le32(crc_ctx->key, req->result); 176 put_unaligned_le32(crc_ctx->key, req->result);
177 177
178 dev_dbg(crc->dev, "init: digest size: %d\n", 178 dev_dbg(ctx->crc->dev, "init: digest size: %d\n",
179 crypto_ahash_digestsize(tfm)); 179 crypto_ahash_digestsize(tfm));
180 180
181 return bfin_crypto_crc_init_hw(crc, crc_ctx->key); 181 return bfin_crypto_crc_init_hw(crc, crc_ctx->key);