Re: svn commit: r316825 - head/sys/netpfil/ipfw

2017-04-14 Thread Andrey V. Elsukov
On 14.04.2017 14:52, Ed Schouten wrote:
> Hi there,
> 
> 2017-04-14 13:41 GMT+02:00 Andrey V. Elsukov :
>> -   memcpy(>k, >addr6.sin6_addr, sizeof(struct 
>> in6_addr));
>> +   memcpy(>k.addr6, >addr6.sin6_addr,
>> +   sizeof(struct in6_addr));
> 
> In this case the code could be abbreviated by simply using assignment, right?
> 
> tent->k.addr6 = xn->addr6.sin6_addr;

Yes.

-- 
WBR, Andrey V. Elsukov



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r316825 - head/sys/netpfil/ipfw

2017-04-14 Thread Ed Schouten
Hi there,

2017-04-14 13:41 GMT+02:00 Andrey V. Elsukov :
> -   memcpy(>k, >addr6.sin6_addr, sizeof(struct 
> in6_addr));
> +   memcpy(>k.addr6, >addr6.sin6_addr,
> +   sizeof(struct in6_addr));

In this case the code could be abbreviated by simply using assignment, right?

tent->k.addr6 = xn->addr6.sin6_addr;

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r316825 - head/sys/netpfil/ipfw

2017-04-14 Thread Andrey V. Elsukov
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.cFri Apr 14 11:19:09 2017
(r316824)
+++ head/sys/netpfil/ipfw/ip_fw_table_algo.cFri 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(>k, >addr6.sin6_addr, sizeof(struct in6_addr));
+   memcpy(>k.addr6, >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(>k, >a.a6, sizeof(struct in6_addr));
+   memcpy(>k.addr6, >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(>k, >sin6_addr, sizeof(struct in6_addr));
+   memcpy(>k.addr6, >sin6_addr,
+   sizeof(struct in6_addr));
len = 128;
if (mask6 != NULL)
len = contigmask((uint8_t *)>sin6_addr, 128);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"