From 165236a101f4f89ecb800bf31d148911b37823e7 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Mon, 13 Jul 2020 19:10:16 +0000 Subject: [PATCH] ipfw(8): Handle unaligned pointers in pr_u64. struct _ipfw_dyn_rule is defined as packed, and as a result, its uint64_t fields are misaligned on some 32-bit platforms. Since pr_u64() is explicitly supposed to handle this case, avoid using a uint64_t * for the input pointer to make sure that the compiler won't (correctly) warn about the misalignment. Reported by: jenkins MFC with: r363164 --- sbin/ipfw/ipfw2.c | 2 +- sbin/ipfw/ipfw2.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index a577fd7e4825..99513e71e3ff 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -501,7 +501,7 @@ bprint_uint_arg(struct buf_pr *bp, const char *str, uint32_t arg) * otherwise, return the required width. */ int -pr_u64(struct buf_pr *b, uint64_t *pd, int width) +pr_u64(struct buf_pr *b, void *pd, int width) { #ifdef TCC #define U64_FMT "I64" diff --git a/sbin/ipfw/ipfw2.h b/sbin/ipfw/ipfw2.h index 106d74cb15b4..764e5176e8ef 100644 --- a/sbin/ipfw/ipfw2.h +++ b/sbin/ipfw/ipfw2.h @@ -328,7 +328,7 @@ struct buf_pr { size_t needed; /* length needed */ }; -int pr_u64(struct buf_pr *bp, uint64_t *pd, int width); +int pr_u64(struct buf_pr *bp, void *pd, int width); int bp_alloc(struct buf_pr *b, size_t size); void bp_free(struct buf_pr *b); int bprintf(struct buf_pr *b, const char *format, ...);