From nobody Thu Nov 28 10:05:30 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 4XzX4W032tz5fVpp; Thu, 28 Nov 2024 10:05:31 +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 4XzX4V41Vcz4NHH; Thu, 28 Nov 2024 10:05:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732788330; 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=eayHWykZxQ29nMC8Yy07V+ZRYGD41bfx8+E5CVAPRDA=; b=Y47JeKadoyP3ilooekFfmu4jg/chSZoa2EJ0N9iQcRxPQq2D03Ab6hrt3rasx5DU5IFIeC NJwLqIB0BVbJTvY91H9TMH6qcWoemnCiNOFN2v8Nggy43cDp/ox+Hv6fRqkVdBMpUweJ0B F+9eiavSCTmEv07DKjEruW80K3OkjyZvKHbTjGl3bHtzGybC8gVCf0Lev3zcRC0ONNpKl5 IybaIWBNgzfyjNS2iN3OdmKbsi4QTuXw8YiC8X5psem7isqb2W3fCnWndn3xFw+Q5g0WuY UUgDPkn2URYewu8rERt3WwPG8oXpaBaitB+z+gNa/JcxCa8MzLcj4j0WQOPdxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732788330; 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=eayHWykZxQ29nMC8Yy07V+ZRYGD41bfx8+E5CVAPRDA=; b=iNye1TBWcWFas8dGXlbJfzO2p5Bmo4ppFHOC9ytDRMUzl8XepkV7NiwefLOGPa/sBj66RE KOpqk8a9r7OhkPEY7Fh/k+UjhFKbNjSVpqfgZMuJvfAh/CxRo/QXpNwlmECCKFwa6orl6N fdCwPxUHr2a/9J8Z8uA8pWnSTxxchzQCzHI6ODibMZsIsOztVmUNYiZwDvi3SBMp06ToJ7 zDE4QSIRSDjBHwoZbS7c0C34jH8sS5q4VJOpktze/BZJIIvI68v9f0a3RUWvHQ3Pu07nEM 6b0s//yhFmS7Of381p59mdS8W7norWqAuHqtA6RTdO5VQN7Yj36a9JOa4/MwUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732788330; a=rsa-sha256; cv=none; b=FRN8cgeTgeCmLy6XDRVFVNmldOXhLbhdXYu6JNx2aN3kll78YvgAj921MH4tXrtPrDUBiV mzCoQvhKg02Sj2WDHcLodlOifznhYpPaXXtInuXPc9TGrkjprJ43ElGlyD/hpdim2AOt95 hB6igy4KgnBh0OTRIFjX0UhPQFcjxsU7eHT6jFHiRUZgASS8F6CttcchHyWZ7TXeFk0EGy Vf7uQu6WzRB023SJZQnw7POpPXYzNLUqtkqTidrXuRVCfcVOa/jnWkgzhfT7cmzC/gbdPn grDN302ubkgdOLLjNP8iNr36HlW/4a1jNMlbBzcy/v1YBWM7/2yldQQ+K/AqNA== 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 4XzX4V3dYQzZhr; Thu, 28 Nov 2024 10:05:30 +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 4ASA5UB6032384; Thu, 28 Nov 2024 10:05:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ASA5UPv032381; Thu, 28 Nov 2024 10:05:30 GMT (envelope-from git) Date: Thu, 28 Nov 2024 10:05:30 GMT Message-Id: <202411281005.4ASA5UPv032381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 949190c5afbc - main - udp: Prefer memcpy() over bcopy() 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 949190c5afbc677c53b5d96354b52256923a11d1 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=949190c5afbc677c53b5d96354b52256923a11d1 commit 949190c5afbc677c53b5d96354b52256923a11d1 Author: Zhenlei Huang AuthorDate: 2024-11-28 10:04:23 +0000 Commit: Zhenlei Huang CommitDate: 2024-11-28 10:04:23 +0000 udp: Prefer memcpy() over bcopy() The variable b[] is on the stack, thus cannot overlap with ipov, which points to the heap area, so prefer memcpy() over memmove(), aka bcopy(). No functional change intended. Reviewed by: cc, rrs, cy, #transport, #network MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47713 --- sys/netinet/udp_usrreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 30c8fff5ea94..c71420b34417 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -544,12 +544,12 @@ udp_input(struct mbuf **mp, int *offp, int proto) char b[offsetof(struct ipovly, ih_src)]; struct ipovly *ipov = (struct ipovly *)ip; - bcopy(ipov, b, sizeof(b)); + memcpy(b, ipov, sizeof(b)); bzero(ipov, sizeof(ipov->ih_x1)); ipov->ih_len = (proto == IPPROTO_UDP) ? uh->uh_ulen : htons(ip_len); uh_sum = in_cksum(m, len + sizeof (struct ip)); - bcopy(b, ipov, sizeof(b)); + memcpy(ipov, b, sizeof(b)); } if (uh_sum) { UDPSTAT_INC(udps_badsum);