Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jan 2017 19:39:36 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r311811 - head/usr.sbin/mfiutil
Message-ID:  <201701091939.v09JdawM050294@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Mon Jan  9 19:39:35 2017
New Revision: 311811
URL: https://svnweb.freebsd.org/changeset/base/311811

Log:
  Avoid taking the address of a packed struct member in mfiutil
  
  Fix a clang 4.0.0 warning about taking the address of a packed member of
  struct mfi_evt in mfiutil:
  
      usr.sbin/mfiutil/mfi_evt.c:583:30: error: taking address of packed
      member 'members' of class or structure 'mfi_evt' may result in an
      unaligned pointer value [-Werror,-Waddress-of-packed-member]
                              if (parse_locale(optarg, &filter.members.locale) < 0) {
                                                        ^~~~~~~~~~~~~~~~~~~~~
  
  Use a local variable instead, and copy that into the struct.
  
  Reviewed by:	jhb
  MFC after:	3 days
  Differential Revision:	https://reviews.freebsd.org/D9069

Modified:
  head/usr.sbin/mfiutil/mfi_evt.c

Modified: head/usr.sbin/mfiutil/mfi_evt.c
==============================================================================
--- head/usr.sbin/mfiutil/mfi_evt.c	Mon Jan  9 19:37:17 2017	(r311810)
+++ head/usr.sbin/mfiutil/mfi_evt.c	Mon Jan  9 19:39:35 2017	(r311811)
@@ -540,6 +540,7 @@ show_events(int ac, char **av)
 	char *cp;
 	ssize_t size;
 	uint32_t seq, start, stop;
+	uint16_t locale;
 	uint8_t status;
 	int ch, error, fd, num_events, verbose;
 	u_int i;
@@ -580,12 +581,13 @@ show_events(int ac, char **av)
 			}
 			break;
 		case 'l':
-			if (parse_locale(optarg, &filter.members.locale) < 0) {
+			if (parse_locale(optarg, &locale) < 0) {
 				error = errno;
 				warn("Error parsing event locale");
 				close(fd);
 				return (error);
 			}
+			filter.members.locale = locale;
 			break;
 		case 'n':
 			val = strtol(optarg, &cp, 0);



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