lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 12 Jan 2015 12:05:30 +0100
From:	Nikolay Aleksandrov <nikolay@...hat.com>
To:	Andy Gospodarek <gospo@...ulusnetworks.com>,
	Jonathan Toppins <jtoppins@...ulusnetworks.com>
CC:	netdev@...r.kernel.org, shm@...ulusnetworks.com
Subject: Re: [PATCH] bonding: cleanup bond_opts array

On 09/01/15 19:48, Andy Gospodarek wrote:
> On Fri, Jan 09, 2015 at 01:31:08PM -0500, Jonathan Toppins wrote:
>> Remove the empty array element initializer and size the array with
>> BOND_OPT_LAST so the compiler will complain if more elements are in
>> there than should be.
>>
>> An interesting unwanted side effect of this initializer is that if one
>> inserts new options into the middle of the array then this initializer
>> will zero out the option that equals BOND_OPT_TLB_DYNAMIC_LB+1.
>>
>> Example:
>> Extend the OPTS enum:
>> enum {
>>    ...
>>    BOND_OPT_TLB_DYNAMIC_LB,
>>    BOND_OPT_LACP_NEW1,
>>    BOND_OPT_LAST
>> };
>>
>> Now insert into bond_opts array:
>> static const struct bond_option bond_opts[] = {
>>       ...
>>       [BOND_OPT_LACP_RATE] = { .... unchanged stuff .... },
>>       [BOND_OPT_LACP_NEW1] = { ... new stuff ... },
>>       ...
>>       [BOND_OPT_TLB_DYNAMIC_LB] = { .... unchanged stuff ....},
>>       { } // MARK A
>> };
>>
>> Since BOND_OPT_LACP_NEW1 = BOND_OPT_TLB_DYNAMIC_LB+1, the last
>> initializer (MARK A) will overwrite the contents of BOND_OPT_LACP_NEW1
>> and can be easily viewed with the crash utility.
>>
>> Signed-off-by: Jonathan Toppins <jtoppins@...ulusnetworks.com>
>> Cc: Andy Gospodarek <gospo@...ulusnetworks.com>
>> Cc: Nikolay Aleksandrov <nikolay@...hat.com>
> 
> I do not recall if there was a specific reason that Nik added this, so
> presuming there was not....
> 
> Signed-off-by: Andy Gospodarek <gospo@...ulusnetworks.com>
> 
Indeed, it's an oversight on my part from a previous version of the opts
patch-set which used a different end-of-array indicator :-)


Acked-by: Nikolay Aleksandrov <nikolay@...hat.com>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists