summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHarsh Jain <harsh@chelsio.com>2016-11-29 14:30:37 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2016-11-30 13:01:46 +0100
commit18f0aa06a3c90b249e8b3a423e67dbfb0c784688 (patch)
treea544ff311bbbaedc088b0a4d101167f9b1f84a06 /drivers
parentcrypto: chcr - Added new structure chcr_wr (diff)
downloadlinux-18f0aa06a3c90b249e8b3a423e67dbfb0c784688.tar.xz
linux-18f0aa06a3c90b249e8b3a423e67dbfb0c784688.zip
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>
Diffstat (limited to 'drivers')
-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);