diff mbox series

[6/6] net: xfrm: Fix end of loop tests for list_for_each_entry

Message ID 20210804070329.1357123-7-steffen.klassert@secunet.com
State New
Headers show
Series [1/6] net: xfrm: fix memory leak in xfrm_user_rcv_msg | expand

Commit Message

Steffen Klassert Aug. 4, 2021, 7:03 a.m. UTC
From: Harshvardhan Jha <harshvardhan.jha@oracle.com>

The list_for_each_entry() iterator, "pos" in this code, can never be
NULL so the warning will never be printed.

Signed-off-by: Harshvardhan Jha <harshvardhan.jha@oracle.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_ipcomp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
index 2e8afe078d61..cb40ff0ff28d 100644
--- a/net/xfrm/xfrm_ipcomp.c
+++ b/net/xfrm/xfrm_ipcomp.c
@@ -241,7 +241,7 @@  static void ipcomp_free_tfms(struct crypto_comp * __percpu *tfms)
 			break;
 	}
 
-	WARN_ON(!pos);
+	WARN_ON(list_entry_is_head(pos, &ipcomp_tfms_list, list));
 
 	if (--pos->users)
 		return;