svn commit: r363166 - head/sbin/ipfw

Mark Johnston markj at FreeBSD.org
Mon Jul 13 19:10:17 UTC 2020


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, ...);


More information about the svn-src-all mailing list