From nobody Sat Aug 20 15:52:36 2022 X-Original-To: dev-commits-src-all@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 4M936X4vhHz4ZcZn; Sat, 20 Aug 2022 15:52:36 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M936X4SqQz3Q6C; Sat, 20 Aug 2022 15:52:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661010756; 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=tk3ZPnz3xzN/jiZgVguqhsIv/jrs8+N/iWPS+Bhs9Vo=; b=BSh5o3NoaiMy+2w4Q2OVnZ4sisRycoyllnpUWeYtE3OxPxVR1dwXaKwAqtSp9n8CATNJBA FQ3fOtPzGZvzKn1a6FuGOdoIcyHaVtOtIT7PDFxtWSBA77tPbCk1bh1dXYnfFp35jOHy6P APQDC0NJx0d2qk6qFPUoW/ZCwB6w0Xf6zPK6QLo3crZ0snvHM1yW32NUaTSvt0rm3cfFAI oyIZ7cf1nTaNYduk+rqeFE0lIh4AlXOF0xzIYlCcLyJTdF+gsrWkrZ0b+7L6FyK3kJhXKf Ea4S9WHJnbZwcmZUt/OEx0fLa3UiVhSwJPjdBBApI1AmSFwHUbx/bh0516N0TA== 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 4M936X3TGzzd9j; Sat, 20 Aug 2022 15:52:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27KFqaEv051662; Sat, 20 Aug 2022 15:52:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27KFqa2S051661; Sat, 20 Aug 2022 15:52:36 GMT (envelope-from git) Date: Sat, 20 Aug 2022 15:52:36 GMT Message-Id: <202208201552.27KFqa2S051661@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 6b598e263beb - main - pf: Reduce diffs against OpenBSD in pf_if.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b598e263bebaf6664b64f80f029a6ebcfc2848d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661010756; 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=tk3ZPnz3xzN/jiZgVguqhsIv/jrs8+N/iWPS+Bhs9Vo=; b=AJUuyXlFkuGfH9DSGFGMSrnD84BV9yA+hcOtPlxrtOzYp2Og0jPUD4ofn3CnTsZuHgPoF7 bcSi+pLcDfMwr8eyzk65RmUNRtmqt4Ubutl4XG7KKMk3W0wMRtao5KzhULxs+H+2EHZrBm Ue9fsx85ifDD8SSktBGJ0qUHJ9bEzl/wZFUpZj618f8e+F6akLTTxk7qwfYbxfEXoKwVjf pC2ZFtWiOE25T9IS9Yvym4ohYwrwwKWPBPD9J1hOvFv7y4txpMvJ8jPHmbXcsVIMb12T4b WNJQqhVizpgvNGuN38eIbCbt/hXgLRINoRvMWVoH5l2rD5q45ctr98fe0q0uFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661010756; a=rsa-sha256; cv=none; b=nVvdHkXL3xUmc9i3gjggGz1CVL4Hv2KdQV0W6OLxYM08LgcmeUo1gI/m/PhRmBaU3fZ2Sd pKXZK278lSdRR5LJMSK61mx12oydoL61zHrTl+rAoG9zZpBRes46E2YnYTv7fpJMsyyBaY nj5tBmKmZipGUXo2vfz8fIUrMw6I8zSI1GZfNQ2Vny3I/kW91Jfrhvzx10++FTiTwfS8P8 HziStid/BsfG3IXCAW6+vhN3d0CcDl5K8p7KtEgdybHcCVA/d0rGPOF1PFAFxsp/ZGEdER A0PVOlbrHq+tIc6Go8xg84Dv24lki/UcU1ryNx2g6lLCAgmI3tyLLqoV2OzBtQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=6b598e263bebaf6664b64f80f029a6ebcfc2848d commit 6b598e263bebaf6664b64f80f029a6ebcfc2848d Author: Ed Maste AuthorDate: 2022-08-19 21:02:26 +0000 Commit: Ed Maste CommitDate: 2022-08-20 15:52:05 +0000 pf: Reduce diffs against OpenBSD in pf_if.c Use memset instead of bzero, memcpy instead of bcopy, and add some optional {}s. Reviewed by: kp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36267 --- sys/netpfil/pf/pf_if.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 02c46db409b6..f572d80c219f 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -319,7 +319,7 @@ pfi_kkif_find(const char *kif_name) PF_RULES_ASSERT(); - bzero(&s, sizeof(s)); + memset(&s, 0, sizeof(s)); strlcpy(s.pfik_name, kif_name, sizeof(s.pfik_name)); return (RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kkif *)&s)); @@ -746,7 +746,7 @@ pfi_address_add(struct sockaddr *sa, int af, int net) if (af == AF_INET && net > 32) net = 128; p = V_pfi_buffer + V_pfi_buffer_cnt++; - bzero(p, sizeof(*p)); + memset(p, 0, sizeof(*p)); p->pfra_af = af; p->pfra_net = net; if (af == AF_INET) @@ -804,21 +804,22 @@ pfi_update_status(const char *name, struct pf_status *pfs) int i, j, k; if (pfs) { - bzero(pfs->pcounters, sizeof(pfs->pcounters)); - bzero(pfs->bcounters, sizeof(pfs->bcounters)); + memset(pfs->pcounters, 0, sizeof(pfs->pcounters)); + memset(pfs->bcounters, 0, sizeof(pfs->bcounters)); } strlcpy(key.pfik_name, name, sizeof(key.pfik_name)); p = RB_FIND(pfi_ifhead, &V_pfi_ifs, (struct pfi_kkif *)&key); - if (p == NULL) + if (p == NULL) { return; + } if (p->pfik_group != NULL) { - bcopy(&p->pfik_group->ifg_members, &ifg_members, + memcpy(&ifg_members, &p->pfik_group->ifg_members, sizeof(ifg_members)); } else { /* build a temporary list for p only */ - bzero(&p_member, sizeof(p_member)); + memset(&p_member, 0, sizeof(p_member)); p_member.ifgm_ifp = p->pfik_ifp; CK_STAILQ_INIT(&ifg_members); CK_STAILQ_INSERT_TAIL(&ifg_members, &p_member, ifgm_next); @@ -848,7 +849,7 @@ static void pf_kkif_to_kif(struct pfi_kkif *kkif, struct pfi_kif *kif) { - bzero(kif, sizeof(*kif)); + memset(kif, 0, sizeof(*kif)); strlcpy(kif->pfik_name, kkif->pfik_name, sizeof(kif->pfik_name)); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) {