git: 5b7192230a15 - main - pf: pf_frag_compare() should not be using subtraction to compare fragment IDs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Apr 2026 11:55:44 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=5b7192230a15bbf2378b8f74278d21d4766c5110
commit 5b7192230a15bbf2378b8f74278d21d4766c5110
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2026-04-16 13:51:54 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-04-17 11:55:06 +0000
pf: pf_frag_compare() should not be using subtraction to compare fragment IDs
Issues reported and patch submitted by:
Renaud Allard <renaud () allard ! it>
OK sashan@
Obtained from: OpenBSD, sashan <sashan@openbsd.org>, 747740863c
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sys/netpfil/pf/pf_norm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c
index 1362ce5387bb..348c1cafbd49 100644
--- a/sys/netpfil/pf/pf_norm.c
+++ b/sys/netpfil/pf/pf_norm.c
@@ -236,10 +236,10 @@ pf_frnode_compare(struct pf_frnode *a, struct pf_frnode *b)
static __inline int
pf_frag_compare(struct pf_fragment *a, struct pf_fragment *b)
{
- int diff;
-
- if ((diff = a->fr_id - b->fr_id) != 0)
- return (diff);
+ if (a->fr_id > b->fr_id)
+ return (1);
+ if (a->fr_id < b->fr_id)
+ return (-1);
return (0);
}