net: xfrm: Fix end of loop tests for list_for_each_entry
authorHarshvardhan Jha <harshvardhan.jha@oracle.com>
Sun, 25 Jul 2021 17:53:55 +0000 (23:23 +0530)
committerSasha Levin <sashal@kernel.org>
Thu, 26 Aug 2021 12:35:35 +0000 (08:35 -0400)
[ Upstream commit 480e93e12aa04d857f7cc2e6fcec181c0d690404 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/xfrm/xfrm_ipcomp.c

index 4d422447aadc363c2551d98c51532a2f5270c9d6..0814320472f188a34cde9e3d42490a5155518f8c 100644 (file)
@@ -250,7 +250,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;