Date: Wed, 14 Jan 2026 08:06:10 +0000 From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: f2d2d6f010e4 - main - pf: remove redundant range checks Message-ID: <69674e72.c70f.2910426@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f2d2d6f010e48410a4435f73aa60ad3dcefccd3b commit f2d2d6f010e48410a4435f73aa60ad3dcefccd3b Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2026-01-12 15:59:22 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2026-01-14 06:44:41 +0000 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 <sashan@openbsd.org>, 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 bc998113dbbb..f6040e2f03a8 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])home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69674e72.c70f.2910426>
