Re: [PATCH v2] sctp: fully initialize the IPv6 address in sctp_v6_to_addr()
From: David Miller
Date: Mon Aug 14 2017 - 22:41:03 EST
From: Marcelo Ricardo Leitner <marcelo.leitner@xxxxxxxxx>
Date: Mon, 14 Aug 2017 22:58:14 -0300
> On Tue, Aug 15, 2017 at 10:43:59AM +0900, 吉藤英明 wrote:
>> > diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
>> > index 2a186b201ad2..a15d691829c6 100644
>> > --- a/net/sctp/ipv6.c
>> > +++ b/net/sctp/ipv6.c
>> > @@ -513,6 +513,8 @@ static void sctp_v6_to_addr(union sctp_addr *addr, struct in6_addr *saddr,
>> > addr->sa.sa_family = AF_INET6;
>> > addr->v6.sin6_port = port;
>> > addr->v6.sin6_addr = *saddr;
>> > + addr->v6.sin6_flowinfo = 0;
>> > + addr->v6.sin6_scope_id = 0;
>>
>> Please set flowinfo between port and addr.
>
> Why?
Store buffer compression.
You want to always initialize structure member in the order
they are in memory.
No, the compiler won't do this automatically.