The branch stable/12 has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=dd1ed4d4878765e2f77f01f2d6f35491221a454a

commit dd1ed4d4878765e2f77f01f2d6f35491221a454a
Author:     Kristof Provost <[email protected]>
AuthorDate: 2021-07-05 12:02:06 +0000
Commit:     Kristof Provost <[email protected]>
CommitDate: 2021-07-16 08:04:13 +0000

    pf: Remove unneeded NULL check
    
    pidx is never NULL, and is used unconditionally later on in the
    function.
    Add an assertion, as documentation for the requirement to provide an idx
    pointer.
    
    Reported by:    clang --analyze
    MFC after:      1 week
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit 8cceacc0f1ee6a77c5f0566b8e6b0f054160fb20)
---
 sys/netpfil/pf/pf_table.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c
index 8dbab5e7bbe1..af7e36c91c08 100644
--- a/sys/netpfil/pf/pf_table.c
+++ b/sys/netpfil/pf/pf_table.c
@@ -2178,6 +2178,8 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct 
pf_addr *counter,
        struct pfr_kentry       *ke, *ke2 = NULL;
        int                      idx = -1, use_counter = 0;
 
+       MPASS(pidx != NULL);
+
        switch (af) {
        case AF_INET:
                uaddr.sin.sin_len = sizeof(struct sockaddr_in);
@@ -2195,8 +2197,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct 
pf_addr *counter,
        if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE))
                return (-1);
 
-       if (pidx != NULL)
-               idx = *pidx;
+       idx = *pidx;
        if (counter != NULL && idx >= 0)
                use_counter = 1;
        if (idx < 0)
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to