Message ID | 1405439595-5544-1-git-send-email-steved@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 07/15/2014 11:53 AM, Steve Dickson wrote: > src/util.c: In function ‘in6_fillscopeid’: > src/util.c:106:3: warning: dereferencing type-punned pointer will break > strict-aliasing rules [-Wstrict-aliasing] > ifindex = ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); > ^ > > src/util.c:109:4: warning: dereferencing type-punned pointer will break > strict-aliasing rules [-Wstrict-aliasing] > *(u_int16_t *)&sin6->sin6_addr.s6_addr[2] = 0; > > Signed-off-by: Steve Dickson <steved@redhat.com> Committed! steved. > --- > src/util.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/src/util.c b/src/util.c > index 9a5fb69..7d56479 100644 > --- a/src/util.c > +++ b/src/util.c > @@ -101,12 +101,14 @@ static void > in6_fillscopeid(struct sockaddr_in6 *sin6) > { > u_int16_t ifindex; > + u_int16_t *addr; > > if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { > - ifindex = ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); > + addr = (u_int16_t *)&sin6->sin6_addr.s6_addr[2]; > + ifindex = ntohs(*addr); > if (sin6->sin6_scope_id == 0 && ifindex != 0) { > sin6->sin6_scope_id = ifindex; > - *(u_int16_t *)&sin6->sin6_addr.s6_addr[2] = 0; > + *addr = 0; > } > } > } > -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/src/util.c b/src/util.c index 9a5fb69..7d56479 100644 --- a/src/util.c +++ b/src/util.c @@ -101,12 +101,14 @@ static void in6_fillscopeid(struct sockaddr_in6 *sin6) { u_int16_t ifindex; + u_int16_t *addr; if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { - ifindex = ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); + addr = (u_int16_t *)&sin6->sin6_addr.s6_addr[2]; + ifindex = ntohs(*addr); if (sin6->sin6_scope_id == 0 && ifindex != 0) { sin6->sin6_scope_id = ifindex; - *(u_int16_t *)&sin6->sin6_addr.s6_addr[2] = 0; + *addr = 0; } } }
src/util.c: In function ‘in6_fillscopeid’: src/util.c:106:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ifindex = ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); ^ src/util.c:109:4: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] *(u_int16_t *)&sin6->sin6_addr.s6_addr[2] = 0; Signed-off-by: Steve Dickson <steved@redhat.com> --- src/util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)