From nobody Mon Aug 29 13:07:06 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 4MGW1R1nJhz4b6Sf; Mon, 29 Aug 2022 13:07:07 +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 4MGW1R1JY6z49vY; Mon, 29 Aug 2022 13:07:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661778427; 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=QwZuBXUrzKefPP/Inki/KtF8dP76fBe7U57F5VKWRw8=; b=OmPtpCk+gItTTqoC8tLaqGYsTvQahKIpomfNeiZ0lmAtrtG0hdK000JeHxujE1ni0ZVN/o B18LQP2ceuDl2SMZDMFrfXZ6dFps6ajKrwA23vuDZUN3x9yu1v4ywA91YXJ3DtpOmbT/3i hxOQes1WWjk4GjnD93QunEUSDgyZT/kF6ZHeikBQab5pF8XJbXLBMddfRKqCxPRxYfwrlk cdEt5bESWzMoYUktCWFHrbf5XYDxe0cziXXqOwXqdQcWYWE7W5lQsuLtzzCh0/0wh14ADD eVOBmKd5rkUVRsi1KuQLPc+N35yxdyRIBI9tvaEfXLAnA2hW62eEx1VXh2SWOQ== 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 4MGW1R05pnzR8K; Mon, 29 Aug 2022 13:07:07 +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 27TD76iG014741; Mon, 29 Aug 2022 13:07:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27TD76fV014740; Mon, 29 Aug 2022 13:07:06 GMT (envelope-from git) Date: Mon, 29 Aug 2022 13:07:06 GMT Message-Id: <202208291307.27TD76fV014740@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 5720c747b237 - stable/12 - 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 5720c747b237998e820afdf370eb5eb9c0268221 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661778427; 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=QwZuBXUrzKefPP/Inki/KtF8dP76fBe7U57F5VKWRw8=; b=DSM5xg3UbduO5in5wJQUufglY1GZGjOwifBlA0jBwJl+O0wdhkb7OI9IruLxKQ9WKNoM1+ CtazcnjlI6b1+cShULPaXdTXsYSww1knnDQFOmsFHZAR2HOHJxoLYZttu4dbt4J5iARbTN pjgdqGAErKZDRmET44mlH8SqGHRfdzgWJPtSv54Vm1AW/DmuGdCIH+KRxWj3P57XnCxhe2 zy8BrZBeLUAcE6G21kzGO02Ql1MEfCaqG9HbkOC94iAepD2ypvVB3L8R0HpQ7qiUG01RXf INirAgzgFQWxruxXf53UqgPzmpXgbmPLloq0bph/pETPVY6lfPeZzgGGIjoAVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661778427; a=rsa-sha256; cv=none; b=c+fS9lYeqmzV0FaF4CoZ/pzgBnQBqOTaqmn4RjCWHplGHuFkE650XQdEHkPHKXlTSfl3wD 3d0XzFz2ThvzhT9kJzyryS4lMfs8HNBEV5hsVC5jmZAcerjX4iTUpZu4ve/7PcVJNuvm3R F8G47mAYLEptgzpl/LkzYs2ttWztRj0gHG9mR8lPYrt+rWR/4HAAxbDTkb5WgO3E7wRY+t Zpyj6EgmeDJNZj2NwElsmaieCTvcyBARqbqpjbws4eff7kKtauhRmMaJVtJ0iDjSX4hr4P 9lKCkexqwFEbW1vzy8XhKTclThFwKAK4jVcw3dAAiXceOnsQ380418CJRa3hAA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5720c747b237998e820afdf370eb5eb9c0268221 commit 5720c747b237998e820afdf370eb5eb9c0268221 Author: Ed Maste AuthorDate: 2022-08-19 21:02:26 +0000 Commit: Ed Maste CommitDate: 2022-08-29 13:06:03 +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 (cherry picked from commit 6b598e263bebaf6664b64f80f029a6ebcfc2848d) --- 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 54ac84365180..55e5e4ccac83 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -295,7 +295,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)); @@ -732,7 +732,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) @@ -790,21 +790,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); @@ -834,7 +835,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++) {