crypto: caam - fix smatch warnings
authorHoria Geantă <horia.geanta@nxp.com>
Wed, 9 Nov 2016 08:46:15 +0000 (10:46 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sun, 13 Nov 2016 09:45:09 +0000 (17:45 +0800)
Fix the following smatch warnings:

drivers/crypto/caam/caamalg.c:2350 aead_edesc_alloc() warn: we tested 'src_nents' before and it was 'true'
drivers/crypto/caam/caamrng.c:351 caam_rng_init() error: no modifiers for allocation.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/caamalg.c
drivers/crypto/caam/caamrng.c

index 5317d8cad44d93a6d7408267f5c251da74813891..bc433edd34c45d040d7f76ed22da12a74961fa47 100644 (file)
@@ -2346,10 +2346,8 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req,
 
        /* Check if data are contiguous. */
        all_contig = !src_nents;
-       if (!all_contig) {
-               src_nents = src_nents ? : 1;
+       if (!all_contig)
                sec4_sg_len = src_nents;
-       }
 
        sec4_sg_len += dst_nents;
 
index bb1c118b2d1b0398aa77a8d0361bf8e522201723..38bb2411afcfc825ccd26adeb0769d22234fa3df 100644 (file)
@@ -348,7 +348,7 @@ static int __init caam_rng_init(void)
                pr_err("Job Ring Device allocation for transform failed\n");
                return PTR_ERR(dev);
        }
-       rng_ctx = kmalloc(sizeof(*rng_ctx), GFP_DMA);
+       rng_ctx = kmalloc(sizeof(*rng_ctx), GFP_DMA | GFP_KERNEL);
        if (!rng_ctx) {
                err = -ENOMEM;
                goto free_caam_alloc;