From nobody Wed May 11 00:30:09 2022 X-Original-To: dev-commits-src-branches@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 34B6E1AE4BD9; Wed, 11 May 2022 00:30:10 +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 4KybQp085Yz4p39; Wed, 11 May 2022 00:30:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652229010; 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=56c6xZsemTiezeJ8KIL7hEoT2gFV1hC+CUNAS0oTgjw=; b=iYwlrAIOxXkMFRX3/efbUim+aH99582L2+qi8munoY3c4vAuCaArFlZ4SsggywukNg4O5b lm7arqRjB4xHOVEhgZKxD1451pgYc0yhJxVddjnkvRu2iZwSV45xM6SuBNPmDeqoeNrQ14 Q84XwlKN9+sH285KdWTlbK9x8gU2369HdHBbauUp2NlGdrDYOCSVopNDGHXU+0k1DDEkLx p3TqnIkThSr39NwovTuZdVpn7bZ5kyXJctrPjiHJjbSt8/w+Sm6bI02791/qWQgSy5QTMQ qCWQELGh46Kl+snuynZJWq8jwVfyXhfFZeH6J563U+RoNfcNzysyRskqKnl15A== 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 69EE77B81; Wed, 11 May 2022 00:30:09 +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 24B0U9Af057537; Wed, 11 May 2022 00:30:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24B0U97V057535; Wed, 11 May 2022 00:30:09 GMT (envelope-from git) Date: Wed, 11 May 2022 00:30:09 GMT Message-Id: <202205110030.24B0U97V057535@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 5bd5219d15c0 - stable/13 - Cast pointer to uintptr_t to avoid alignment warnings. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5bd5219d15c0408eac7083317a20706e23e9bea8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652229010; 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=56c6xZsemTiezeJ8KIL7hEoT2gFV1hC+CUNAS0oTgjw=; b=gG3aveC1jtzLIFYYpDZqypfKfxMTYXaAQ35wRRbmjdW6zRlXXc4qmLIWbaTkStbdwLacpd EMgeZVeLRMgcfDd0lFvCT0CkniKH0FxlaBwOuYm5fxYS6AA7XkvLBpGkRksiT7u/JP9q4Z pZorJ4couCr8YBl3BgKYokDfaGek8u79WhHc/ZhMIbIbc3ryADn8Fe0cnsWLVUZCnhR9DD sN5m12Um+VmqmzzELuB0MQ/0DnmIQCtyieASeV7P4CNXpgWWUln2cJo2DG5mu+cRDZZDOb pcE7fSjD2Biva/LUO8umApAR/9DuJf/zkfFqi9K6dQ0RcdCTAjFBAUY4hisIVA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652229010; a=rsa-sha256; cv=none; b=IgJ3pnIf69nhDYbmhsOAJlR+s+BMaZ17xV0hGgYGPDKCqZvENVgz+EctIn6JpzYE0rR2Hm R5AArtMDz4Y8Hvp/ZQELwDzmdO/j/w/srPP0bF+bQi4q4i338FABj+M0RTeTysstDSBdP8 r0QH+VbEkRGyzMGi7nJjseRzND1LkUgXjf/cq42UCq8uh9UxbV5fheSY+4QJJM3SLhbTvX MC8WBL0dkJLlPZrBBsNnk8HUzJ82vRLT+TcDDG8CEU47JVrFNTj3IYmta3r5HbanN7AgGa l/4IjgHzGgEKydOqJ1MQ9kcsVnNqcw3X+hfd6Lrqeu4WWM3fBf7XjFrKMIFzpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5bd5219d15c0408eac7083317a20706e23e9bea8 commit 5bd5219d15c0408eac7083317a20706e23e9bea8 Author: John Baldwin AuthorDate: 2022-02-12 00:04:52 +0000 Commit: John Baldwin CommitDate: 2022-05-11 00:11:27 +0000 Cast pointer to uintptr_t to avoid alignment warnings. Both struct ip and struct udphdr both have an aligment of 2, but the cast from struct ip to a uint32_t pointer confused GCC 9 into raising the required alignment to 4 and then raising a -Waddress-of-packed-member error when casting to struct udphdr. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31941 (cherry picked from commit dba02df30d536922727a7ea509514462452a247a) --- tests/sys/netinet/libalias/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/netinet/libalias/util.c b/tests/sys/netinet/libalias/util.c index 681c3b20ee41..14ba196a59a5 100644 --- a/tests/sys/netinet/libalias/util.c +++ b/tests/sys/netinet/libalias/util.c @@ -109,9 +109,9 @@ ip_packet(u_char protocol, size_t len) struct udphdr * set_udp(struct ip *p, u_short sport, u_short dport) { - uint32_t *up = (void *)p; - struct udphdr *u = (void *)&(up[p->ip_hl]); - int payload = ntohs(p->ip_len) - 4*p->ip_hl; + int hlen = p->ip_hl << 2; + struct udphdr *u = (struct udphdr *)((uintptr_t)p + hlen); + int payload = ntohs(p->ip_len) - hlen; REQUIRE(payload >= (int)sizeof(*u)); p->ip_p = IPPROTO_UDP;