Date: Mon, 13 Jul 2020 19:10:16 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363166 - head/sbin/ipfw Message-ID: <202007131910.06DJAG1p051916@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Mon Jul 13 19:10:16 2020 New Revision: 363166 URL: https://svnweb.freebsd.org/changeset/base/363166 Log: 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 Modified: head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Jul 13 18:19:02 2020 (r363165) +++ head/sbin/ipfw/ipfw2.c Mon Jul 13 19:10:16 2020 (r363166) @@ -501,7 +501,7 @@ bprint_uint_arg(struct buf_pr *bp, const char *str, ui * 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" Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Mon Jul 13 18:19:02 2020 (r363165) +++ head/sbin/ipfw/ipfw2.h Mon Jul 13 19:10:16 2020 (r363166) @@ -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, ...);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007131910.06DJAG1p051916>