crypto: chcr - Fixes Unchecked dereference inside function
authorHarsh Jain <harsh@chelsio.com>
Tue, 29 Nov 2016 13:30:37 +0000 (19:00 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 30 Nov 2016 12:01:46 +0000 (20:01 +0800)
Fixes 324429d74127, Unchecked dereference inside function.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jitendra Lulla <JLULLA@chelsio.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/chelsio/chcr_algo.c

index d24b7ce7914261e64eabefb07093fe4275fd14e8..0ae1b09c58ef956538d1b174b4aec241c9cbdd73 100644 (file)
@@ -439,8 +439,9 @@ write_sg_to_skb(struct sk_buff *skb, unsigned int *frags,
        skb->len += count;
        skb->data_len += count;
        skb->truesize += count;
+
        while (count > 0) {
-               if (sg && (!(sg->length)))
+               if (!sg || (!(sg->length)))
                        break;
                spage = sg_page(sg);
                get_page(spage);