Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net] net: xfrm: Fix end of loop tests for list_for_each_entry
@ 2021-07-25 17:53 Harshvardhan Jha
2021-07-28 6:55 ` Steffen Klassert
0 siblings, 1 reply; 2+ messages in thread
From: Harshvardhan Jha @ 2021-07-25 17:53 UTC (permalink / raw)
To: steffen.klassert
Cc: herbert, davem, kuba, netdev, linux-kernel, Harshvardhan Jha
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>
---
From static analysis. Not tested.
---
net/xfrm/xfrm_ipcomp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: xfrm: Fix end of loop tests for list_for_each_entry
2021-07-25 17:53 [PATCH net] net: xfrm: Fix end of loop tests for list_for_each_entry Harshvardhan Jha
@ 2021-07-28 6:55 ` Steffen Klassert
0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2021-07-28 6:55 UTC (permalink / raw)
To: Harshvardhan Jha; +Cc: herbert, davem, kuba, netdev, linux-kernel
On Sun, Jul 25, 2021 at 11:23:55PM +0530, Harshvardhan Jha wrote:
> 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>
Applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-28 6:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-25 17:53 [PATCH net] net: xfrm: Fix end of loop tests for list_for_each_entry Harshvardhan Jha
2021-07-28 6:55 ` Steffen Klassert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).