diff options
author | Harsh Jain <harsh@chelsio.com> | 2016-11-29 16:30:37 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-11-30 15:01:46 +0300 |
commit | 18f0aa06a3c90b249e8b3a423e67dbfb0c784688 (patch) | |
tree | a544ff311bbbaedc088b0a4d101167f9b1f84a06 /drivers/crypto/chelsio | |
parent | 358961d1cd1ee78bf2d7d573d21eafce53ba4280 (diff) | |
download | linux-18f0aa06a3c90b249e8b3a423e67dbfb0c784688.tar.xz |
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/crypto/chelsio')
-rw-r--r-- | drivers/crypto/chelsio/chcr_algo.c | 3 |
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); |