Browse Source

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>
Harsh Jain 8 years ago
parent
commit
18f0aa06a3
1 changed files with 2 additions and 1 deletions
  1. 2 1
      drivers/crypto/chelsio/chcr_algo.c

+ 2 - 1
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);