git: 0dfd11abc4bd - main - bpf: Make bpf_peers_present a boolean inline function

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Fri, 07 Jun 2024 15:07:35 UTC
The branch main has been updated by zlei:

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

commit 0dfd11abc4bd0dcb96a6d287cc4e52e8f59b64c1
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-06-07 15:06:08 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-06-07 15:06:08 +0000

    bpf: Make bpf_peers_present a boolean inline function
    
    This function was introduced in commit [1] and is actually used as a
    boolean function although it was not defined as so.
    
    No functional change intended.
    
    1. 16d878cc99ef Fix the following bpf(4) race condition which can result in a panic
    
    Reviewed by:    markj, kp, #network
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45509
---
 sys/net/bpf.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/net/bpf.h b/sys/net/bpf.h
index 0fd7c4105b30..e44a7cd2359d 100644
--- a/sys/net/bpf.h
+++ b/sys/net/bpf.h
@@ -433,15 +433,13 @@ int	 bpf_get_bp_params(struct bpf_if *, u_int *, u_int *);
 void	 bpfilterattach(int);
 u_int	 bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int);
 
-static __inline int
+static __inline bool
 bpf_peers_present(struct bpf_if *bpf)
 {
 	struct bpf_if_ext *ext;
 
 	ext = (struct bpf_if_ext *)bpf;
-	if (!CK_LIST_EMPTY(&ext->bif_dlist))
-		return (1);
-	return (0);
+	return (!CK_LIST_EMPTY(&ext->bif_dlist));
 }
 
 #define	BPF_TAP(_ifp,_pkt,_pktlen)				\