From nobody Fri Dec 06 13:52:37 2024 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 4Y4Xkv2M9Bz5gKHT; Fri, 06 Dec 2024 13:52:39 +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 4Y4Xks59f1z46s1; Fri, 6 Dec 2024 13:52:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733493157; 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=XbCAY1vHiR25D9ZDc9egvht5LIauHXCjuEvZ3Q33DSw=; b=hbbEZawZC011qWogvbcYPY83yIxq7qjsD8cSAG0CzLzW/MdWapp0pOykKD11Z4UtIOJdOX y1ZmsHChZautO0bsBP5sHJI9UgbUC20JvLqBkUSFRZgRH6nc/NSTdrXbg8Q/jOStt+6iTq l2Ybl2fQtSF3cvfztQQKfmngHgo56xCgFSNhzLUYHJY2xhbr1ZaIUlWi465YMfSYwVDe19 7CKGcO4oOS6IrfNFVJqje+LNk8OndA5vEKaDAhyuvIgjwWYOFfwWx2zazz9M/lY3/7NMoV LqB0a6XYx38+JQZr3ar2fWeK33JYZ5O10s0GIZpKYBjv9ACVNUTMWS1A5ikm5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733493157; 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=XbCAY1vHiR25D9ZDc9egvht5LIauHXCjuEvZ3Q33DSw=; b=i7mIk66bUQ7lzwcYd3zwe6WVWzuNHTLG0sD6t5zzaooCdBGAk8Hb0j2HZmzg/PWzVF0zcH g+sfLMYaKH+fAgH8aWQuaNQwVHGtWuNObahsKTpJ5UJpMjbaiQ6/IjEj0nM4Q5w9KpUIch b2yHoWaJyXtpl8eYd+3x8/P/+2/JF94e8jPmIsD5A2IDIOWhFwlPSPa+S4gakIaz4xYpt0 fPafImrY5s/4PZqIGtY8XB6vbMTnPfQx8Y/whpE4ER5k4Mnq0JeAydoVJ3i9ORwZHO0mbE GybcPB5OuI+2b+ZCWPc1quu58ptI0UaxBNyDKzjPEw9orhqpHY9Qrst21O5Nqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733493157; a=rsa-sha256; cv=none; b=YYsqMy5nf6ifVS2h0nBoJNB07v0Tu/gZcyii8hQ8ZHA211hbc7mMcDUyqhR8MY21JXErh7 yZcOjvAXwSS4x7pIz8iFwmqlkNyRjwpIM2W1xxc4Xvg9VI+obULFJQUVbGeWlAaXI5CL9D QX3NY0KQW+B5Fjv+w0U1vW1yRrWBZ/inotxK9MSgAAoaD7/NmxEOr45HW0z/MjROtH9YDv 2jxuqb2KFzhkF4ARmaJRI8gqeYmJK3jLW1QbQxflsG7NnvKjjjAGCrCAYpP0BKAwHij8W2 +jyzv5XQCN9M+Y3bBZ1fGOVxCNrbMZ3hKxOvoKMDODMGrQjs4zlI2kyt4AiHEQ== 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 4Y4Xks4ZpNzgS7; Fri, 6 Dec 2024 13:52:37 +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 4B6DqbvT019044; Fri, 6 Dec 2024 13:52:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B6Dqbud019041; Fri, 6 Dec 2024 13:52:37 GMT (envelope-from git) Date: Fri, 6 Dec 2024 13:52:37 GMT Message-Id: <202412061352.4B6Dqbud019041@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 0b80bf9edb19 - stable/14 - udp: Prefer memcpy() over bcopy() 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 0b80bf9edb199ca35dae25241e2dc38bd7e84cb9 Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=0b80bf9edb199ca35dae25241e2dc38bd7e84cb9 commit 0b80bf9edb199ca35dae25241e2dc38bd7e84cb9 Author: Zhenlei Huang AuthorDate: 2024-11-28 10:04:23 +0000 Commit: Zhenlei Huang CommitDate: 2024-12-06 13:51:42 +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 (cherry picked from commit 949190c5afbc677c53b5d96354b52256923a11d1) --- 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 7329600ecc79..47f7eb65f119 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -546,12 +546,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);