Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jan 2021 21:38:17 GMT
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a81c165bce14 - main - Require uint32_t alignment for ipfw_insn
Message-ID:  <202101192138.10JLcHIQ078451@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=a81c165bce14257a5fee298214db181e3147ea19

commit a81c165bce14257a5fee298214db181e3147ea19
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-01-19 11:32:33 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2021-01-19 21:23:25 +0000

    Require uint32_t alignment for ipfw_insn
    
    There are many casts of this struct to uint32_t, so we also need to ensure
    that it is sufficiently aligned to safely perform this cast on architectures
    that don't allow unaligned accesses. This fixes lots of -Wcast-align warnings.
    
    Reviewed By:    ae
    Differential Revision: https://reviews.freebsd.org/D27879
---
 sys/netinet/ip_fw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netinet/ip_fw.h b/sys/netinet/ip_fw.h
index 57d2a4c607e8..f0531a67132d 100644
--- a/sys/netinet/ip_fw.h
+++ b/sys/netinet/ip_fw.h
@@ -339,7 +339,7 @@ enum ipfw_opcodes {		/* arguments (4 byte each)	*/
  *
  */
 typedef struct	_ipfw_insn {	/* template for instructions */
-	u_int8_t 	opcode;
+	_Alignas(_Alignof(u_int32_t)) u_int8_t 	opcode;
 	u_int8_t	len;	/* number of 32-bit words */
 #define	F_NOT		0x80
 #define	F_OR		0x40



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101192138.10JLcHIQ078451>