Skip to contentSkip to conversation

net: xfrm: Fix end of loop tests for list_for_each_entry

PATCH Applied Harshvardhan Jha 2 participants 2 messages Jul 25, 2021 – Jul 28, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: xfrm: Fix end of loop tests for list_for_each_entry

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

---
From static analysis. Not tested.

---
 net/xfrm/xfrm_ipcomp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_ipcomp.c +1 -1
index 2e8afe078d61..cb40ff0ff28d 100644
@@ -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;
Signature · 1 line
2.32.0