Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Apr 2017 11:41:09 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316825 - head/sys/netpfil/ipfw
Message-ID:  <201704141141.v3EBf9MC097085@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Fri Apr 14 11:41:09 2017
New Revision: 316825
URL: https://svnweb.freebsd.org/changeset/base/316825

Log:
  Use address of specific union member instead of whole union address to
  fix PVS-Studio warnings.
  
  MFC after:	1 week

Modified:
  head/sys/netpfil/ipfw/ip_fw_table_algo.c

Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c
==============================================================================
--- head/sys/netpfil/ipfw/ip_fw_table_algo.c	Fri Apr 14 11:19:09 2017	(r316824)
+++ head/sys/netpfil/ipfw/ip_fw_table_algo.c	Fri Apr 14 11:41:09 2017	(r316825)
@@ -526,7 +526,8 @@ ta_dump_radix_tentry(void *ta_state, str
 #ifdef INET6
 	} else {
 		xn = (struct radix_addr_xentry *)e;
-		memcpy(&tent->k, &xn->addr6.sin6_addr, sizeof(struct in6_addr));
+		memcpy(&tent->k.addr6, &xn->addr6.sin6_addr,
+		    sizeof(struct in6_addr));
 		tent->masklen = xn->masklen;
 		tent->subtype = AF_INET6;
 		tent->v.kidx = xn->value;
@@ -1381,7 +1382,7 @@ ta_dump_chash_tentry(void *ta_state, str
 		tent->v.kidx = ent->value;
 #ifdef INET6
 	} else {
-		memcpy(&tent->k, &ent->a.a6, sizeof(struct in6_addr));
+		memcpy(&tent->k.addr6, &ent->a.a6, sizeof(struct in6_addr));
 		tent->masklen = cfg->mask6;
 		tent->subtype = AF_INET6;
 		tent->v.kidx = ent->value;
@@ -3983,7 +3984,8 @@ ta_dump_kfib_tentry_int(struct sockaddr 
 	if (paddr->sa_family == AF_INET6) {
 		addr6 = (struct sockaddr_in6 *)paddr;
 		mask6 = (struct sockaddr_in6 *)pmask;
-		memcpy(&tent->k, &addr6->sin6_addr, sizeof(struct in6_addr));
+		memcpy(&tent->k.addr6, &addr6->sin6_addr,
+		    sizeof(struct in6_addr));
 		len = 128;
 		if (mask6 != NULL)
 			len = contigmask((uint8_t *)&mask6->sin6_addr, 128);



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