aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Jain2016-11-29 19:00:37 +0530
committerHerbert Xu2016-11-30 20:01:46 +0800
commit18f0aa06a3c90b249e8b3a423e67dbfb0c784688 (patch)
treea544ff311bbbaedc088b0a4d101167f9b1f84a06
parent358961d1cd1ee78bf2d7d573d21eafce53ba4280 (diff)
crypto: chcr - Fixes Unchecked dereference inside function
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>
-rw-r--r--drivers/crypto/chelsio/chcr_algo.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index d24b7ce79142..0ae1b09c58ef 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -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);