bonding: bond_get_size() returns wrong size
Subsystems (4)
PATCH 1/1 bonding: bond_get_size() returns wrong size
There is an extra semi-colon so bond_get_size() doesn't return the correct value.
drivers/net/bonding/bond_netlink.c +2 -2
@@ -82,8 +82,8 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev,static size_t bond_get_size (const struct net_device *bond_dev) { -return nla_total_size (sizeof (u8));/* IFLA_BOND_MODE */ - +nla_total_size (sizeof (u32));/* IFLA_BOND_ACTIVE_SLAVE */ +return nla_total_size (sizeof (u8)) +/* IFLA_BOND_MODE */ +nla_total_size (sizeof (u32));/* IFLA_BOND_ACTIVE_SLAVE */ } static int bond_fill_info(struct sk_buff *skb,
Quoted 5 lines · Dan Carpenter
There is an extra semi-colon so
bond_get_size()doesn't return the correct value.Fixes ec76aa49855f ('bonding: add Netlink support active_slave option')Signed-off-by Dan Carpenter <[email protected]>
Hrm, how does it even build. Good catch, thanks.
Quoted 16 lines
drivers/net/bonding/bond_netlink.c +2
-2@@ -82,8 +82,8 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev,static size_t bond_get_size (const struct net_device *bond_dev) { -return nla_total_size (sizeof (u8));/* IFLA_BOND_MODE */ - +nla_total_size (sizeof (u32));/* IFLA_BOND_ACTIVE_SLAVE */ +return nla_total_size (sizeof (u8)) +/* IFLA_BOND_MODE */ +nla_total_size (sizeof (u32));/* IFLA_BOND_ACTIVE_SLAVE */ } static int bond_fill_info(struct sk_buff *skb,
Quoted 10 lines · Veaceslav Falico
Quoted 5 lines · Dan Carpenter
There is an extra semi-colon so
bond_get_size()doesn't return the correct value.Fixes ec76aa49855f ('bonding: add Netlink support active_slave option')Signed-off-by Dan Carpenter <[email protected]>Hrm, how does it even build. Good catch, thanks.
Acked-by Veaceslav Falico <[email protected]>
Yep, an alternative is to use following format :
static inline size_t br_port_info_size(void)
{
return nla_total_size(1) /* IFLA_BRPORT_STATE */
+ nla_total_size(2) /* IFLA_BRPORT_PRIORITY */
+ nla_total_size(4) /* IFLA_BRPORT_COST */
+ nla_total_size(1) /* IFLA_BRPORT_MODE */
+ nla_total_size(1) /* IFLA_BRPORT_GUARD */
+ nla_total_size(1) /* IFLA_BRPORT_PROTECT */
+ nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */
+ nla_total_size(1) /* IFLA_BRPORT_LEARNING */
+ nla_total_size(1) /* IFLA_BRPORT_UNICAST_FLOOD */ + 0;
}
So that a patch adding a new attribute doesn't have to change the 'last line'
Jiri Pirko
Reviewed-byQuoted 8 lines · Fri, Nov 01, 2013 at 11:41:00AM CET, [email protected] wrote:
Quoted 5 lines · Dan Carpenter
There is an extra semi-colon so
bond_get_size()doesn't return the correct value.Fixes ec76aa49855f ('bonding: add Netlink support active_slave option')Signed-off-by Dan Carpenter <[email protected]>Hrm, how does it even build. Good catch, thanks.
I wonder about the same thing.
Quoted 19 lines
Acked-by Veaceslav Falico <[email protected]>Quoted 16 lines
drivers/net/bonding/bond_netlink.c +2
-2@@ -82,8 +82,8 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev,static size_t bond_get_size (const struct net_device *bond_dev) { -return nla_total_size (sizeof (u8));/* IFLA_BOND_MODE */ - +nla_total_size (sizeof (u32));/* IFLA_BOND_ACTIVE_SLAVE */ +return nla_total_size (sizeof (u8)) +/* IFLA_BOND_MODE */ +nla_total_size (sizeof (u32));/* IFLA_BOND_ACTIVE_SLAVE */ } static int bond_fill_info(struct sk_buff *skb,
Quoted 5 lines · Jiri Pirko
Quoted 4 lines · Fri, Nov 01, 2013 at 11:41:00AM CET, [email protected] wrote:
Quoted 3 lines · Dan Carpenter
There is an extra semi-colon so
bond_get_size()doesn't return the correct value.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Fixes ec76aa49855f ('bonding: add Netlink support active_slave option')Signed-off-by Dan Carpenter <[email protected]>Hrm, how does it even build. Good catch, thanks.
I wonder about the same thing.
+ and - can be unary operators so it's a valid expression :-) Nice catch
Nik
Am 01.11.2013 13:25, schrieb Nikolay Aleksandrov:
Quoted 9 lines · Jiri Pirko
Quoted 8 lines
Quoted 7 lines · Fri, Nov 01, 2013 at 11:41:00AM CET, [email protected] wrote:
Quoted 5 lines · Dan Carpenter
There is an extra semi-colon so
bond_get_size()doesn't return the correct value.Fixes ec76aa49855f ('bonding: add Netlink support active_slave option')Signed-off-by Dan Carpenter <[email protected]>
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Hrm, how does it even build. Good catch, thanks.
I wonder about the same thing.
+ and - can be unary operators so it's a valid expression :-) Nice catch
NTL my gcc warns (-Wall)
warning: statement with no effect
this should come up.
re,
wh
Quoted 7 lines
Nik
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Dan Carpenter <[email protected]>
Date: Fri, 1 Nov 2013 13:18:44 +0300
Quoted 5 lines
There is an extra semi-colon so
bond_get_size()doesn't return the correct value.Fixes ec76aa49855f ('bonding: add Netlink support active_slave option')Signed-off-by Dan Carpenter <[email protected]>
Applied, thanks a lot Dan.