crypto: chcr - Fixes Unchecked dereference inside function

Fixes 324429d741, 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>
This commit is contained in:
Harsh Jain 2016-11-29 19:00:37 +05:30 committed by Herbert Xu
parent 358961d1cd
commit 18f0aa06a3
1 changed files with 2 additions and 1 deletions

View 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);