From nobody Sun Nov 03 16:48:07 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XhLBc28GLz5cRGJ; Sun, 03 Nov 2024 16:48:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XhLBc07T5z4XLm; Sun, 3 Nov 2024 16:48:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730652488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rAOPIVBGkldNaKmGEXkl9B18gsd2z6pe1xRabX7U8jk=; b=lAvgzF7r46eclldiPrOyL3Utl1f7B3gdCwbvEjwNeTNeZcVH6OQ0eOXV5yuCfv44KpyRn9 T65wz2PJNFrHn0zHOimUZQR3sEYi/h0zVf3jr2Mel4IxZFdj4PQUBe7DSvBHBQKSj4PYqk ZrgDNa2osbFzNJjYpIdGtI3Fance44lwTKjC5Ys3DlIT/2uQMtpnaA3gh6SzLEB8GSl0+Q FnXJosQQstPvwu/TmGYc2E8WAlR86rGVM6bOwKdfzjUheQ4Yq7MDNdHdV3mkjNAHJysf1N 3km8TjbQLOg8SclFn4H7EPvoprpa0PSNUhGg9ov/ZCggWAQ3ypZDv4+p5zcfPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730652488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rAOPIVBGkldNaKmGEXkl9B18gsd2z6pe1xRabX7U8jk=; b=safth+Iab0/tBPqMC/UbDEKAJGyUfHAvJzP6QyxaIqCQOTj7sxm+UDi7PSs4pCvvD7RMSs bW/zgndct67yhNbEUdUB5A2BkQnpH6UCr8cSRbuoX4O6UdRy3BbDCAY6zqcTqWiEiY3c61 X88aXWnmsie9h8x0yVS4HHGlYD37pM68Ekyz7wASuz7+dVDbkLv1G7vz8MycYmuFQ6oER3 rf/xH8JzZ0La+rA4oPuckzshwpPcD8iUFjkFKjdBsUcsXgy8+Cmcla5c/VEaNI+aGlbKql epUUxW4eMGgYh4MP6buumTiA90Klo+IEJla6YWXr5UPmPpTHL1WLVLz5clS4uw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730652488; a=rsa-sha256; cv=none; b=wTMMQqqOYdrAnsZQJbw3FZjmNxagfNx+UL2+1PrhEuHP6G/EvDBHBRptaRrIbH94f8rs1k uMrUYR+iKZZ4pvPuX+jxVdXo8LpIEUqdD4DIQxRrnNfzzOCkUElqYyhx9zjtnL1PPy5muu jaQpHFI+HYoaLAXSZyY9GummbwJfcbx2TI1PBpJzhhFkAXoLqGZAo6P9a3lF6AZyxKFDHd JZ4vBODiopEhrCvv0uF/l7ISw9k33oKvLVX2qyUF3LAKGzP/vRyL/clU8Xk5y1Li8DaPje t98jlxnsOCQTu/SFqCiBx0EqxohcvxGlDpuR489+HAncisAj4yrlgfepovrwJQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XhLBb6jthzwgy; Sun, 3 Nov 2024 16:48:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4A3Gm72C092190; Sun, 3 Nov 2024 16:48:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A3Gm7mk092186; Sun, 3 Nov 2024 16:48:07 GMT (envelope-from git) Date: Sun, 3 Nov 2024 16:48:07 GMT Message-Id: <202411031648.4A3Gm7mk092186@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4ee6a830d6c1 - main - pf: Fix a use of an uninitialized variable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ee6a830d6c191c1c420b6764a4d388f756168d3 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4ee6a830d6c191c1c420b6764a4d388f756168d3 commit 4ee6a830d6c191c1c420b6764a4d388f756168d3 Author: Mark Johnston AuthorDate: 2024-11-03 14:36:39 +0000 Commit: Mark Johnston CommitDate: 2024-11-03 16:46:53 +0000 pf: Fix a use of an uninitialized variable pf_find_state_all() expects the caller to initialize "*more" if it is non-NULL, but pf_handle_natlook() didn't obey this protocol. Follow the pattern from OpenBSD and initialize it in the caller. Also make pf_find_state_all() unconditionally initialize "*more" for good measure. Fixes: 71d3c7041d70 ("pf: convert DIOCNATLOOK to netlink") Reported by: KMSAN Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D47405 --- sys/netpfil/pf/pf.c | 3 +++ sys/netpfil/pf/pf_nl.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index a98baeb4bdec..17614e1a9995 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1798,6 +1798,9 @@ pf_find_state_all(const struct pf_state_key_cmp *key, u_int dir, int *more) struct pf_kstate *s, *ret = NULL; int idx, inout = 0; + if (more != NULL) + *more = 0; + pf_counter_u64_add(&V_pf_status.fcounters[FCNT_STATE_SEARCH], 1); kh = &V_pf_keyhash[pf_hashkey((const struct pf_state_key *)key)]; diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c index 67047a319fb8..1da9bead394b 100644 --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -1264,7 +1264,7 @@ pf_handle_natlook(struct nlmsghdr *hdr, struct nl_pstate *npt) struct pf_state_key *sk; struct pf_kstate *state; struct genlmsghdr *ghdr_new; - int error, m; + int error, m = 0; int sidx, didx; error = nl_parse_nlmsg(hdr, &natlook_parser, npt, &attrs);