git: a81c165bce14 - main - Require uint32_t alignment for ipfw_insn
Alex Richardson
arichardson at FreeBSD.org
Tue Jan 19 21:38:18 UTC 2021
The branch main has been updated by arichardson:
URL: https://cgit.FreeBSD.org/src/commit/?id=a81c165bce14257a5fee298214db181e3147ea19
commit a81c165bce14257a5fee298214db181e3147ea19
Author: Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2021-01-19 11:32:33 +0000
Commit: Alex Richardson <arichardson at 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
More information about the dev-commits-src-main
mailing list