From f2d2d6f010e48410a4435f73aa60ad3dcefccd3b Mon Sep 17 00:00:00 2001 From: Kristof Provost Date: Mon, 12 Jan 2026 16:59:22 +0100 Subject: [PATCH] pf: remove redundant range checks the range checks are not needed because both members (statelim and sourcelim) are uint8_t, they implicitly fit desired range <0, 255>. Unbreaks gcc build. Pointed out by deraadt@ OK deraadt@ Obtained from: OpenBSD, sashan , 3a7be1e428 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index bc998113dbb..f6040e2f03a 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2950,18 +2950,6 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, if (pf_validate_range(rule->dst.port_op, rule->dst.port)) ERROUT_UNLOCKED(EINVAL); - if (rule->statelim != PF_STATELIM_ID_NONE) { - if (rule->statelim < PF_STATELIM_ID_MIN || - rule->statelim > PF_STATELIM_ID_MAX) - ERROUT_UNLOCKED(EINVAL); - } - - if (rule->sourcelim != PF_SOURCELIM_ID_NONE) { - if (rule->sourcelim < PF_SOURCELIM_ID_MIN || - rule->sourcelim > PF_SOURCELIM_ID_MAX) - ERROUT_UNLOCKED(EINVAL); - } - if (rule->ifname[0]) kif = pf_kkif_create(M_WAITOK); if (rule->rcv_ifname[0])