]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
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)
committerSteffen Klassert <steffen.klassert@secunet.com>
Mon, 26 Jul 2021 10:26:28 +0000 (12:26 +0200)
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

index 2e8afe078d6129143c4572a8d2bba02c822a2fc1..cb40ff0ff28da274222b6a6b4971dec354c147e2 100644 (file)
@@ -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;