1
0
Fork 0
alistair23-linux/drivers/net/bonding
Jonathan Toppins 7bfa014500 bonding: cleanup bond_opts array
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@cumulusnetworks.com>
Cc: Andy Gospodarek <gospo@cumulusnetworks.com>
Cc: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com>
Acked-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-01-12 16:39:31 -05:00
..
Makefile bonding: add sysfs /slave dir for bond slave devices. 2014-01-17 18:51:58 -08:00
bond_3ad.c bonding: Introduce 4 AD link speed to fix agg_bandwidth 2014-11-19 19:10:16 -05:00
bond_alb.c vlan: kill vlan_put_tag helper 2014-11-21 14:20:17 -05:00
bond_debugfs.c net: Move bonding headers under include/net 2014-11-10 13:27:49 -05:00
bond_main.c bonding: change error message to debug message in __bond_release_one() 2014-12-27 02:20:55 -05:00
bond_netlink.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-12-10 15:48:20 -05:00
bond_options.c bonding: cleanup bond_opts array 2015-01-12 16:39:31 -05:00
bond_procfs.c net: Move bonding headers under include/net 2014-11-10 13:27:49 -05:00
bond_sysfs.c net: Move bonding headers under include/net 2014-11-10 13:27:49 -05:00
bond_sysfs_slave.c net: Move bonding headers under include/net 2014-11-10 13:27:49 -05:00