netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch -next] bonding: bond_get_size() returns wrong size
@ 2013-11-01 10:18 Dan Carpenter
  2013-11-01 10:41 ` Veaceslav Falico
  2013-11-02  6:09 ` David Miller
  0 siblings, 2 replies; 7+ messages in thread
From: Dan Carpenter @ 2013-11-01 10:18 UTC (permalink / raw)
  To: Jay Vosburgh
  Cc: Veaceslav Falico, Andy Gospodarek, netdev, kernel-janitors,
	Jiri Pirko

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 <dan.carpenter@oracle.com>

diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
index 7661261..40e7b1c 100644
--- a/drivers/net/bonding/bond_netlink.c
+++ b/drivers/net/bonding/bond_netlink.c
@@ -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,

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [patch -next] bonding: bond_get_size() returns wrong size
  2013-11-01 10:18 [patch -next] bonding: bond_get_size() returns wrong size Dan Carpenter
@ 2013-11-01 10:41 ` Veaceslav Falico
  2013-11-01 10:52   ` Eric Dumazet
  2013-11-01 11:35   ` Jiri Pirko
  2013-11-02  6:09 ` David Miller
  1 sibling, 2 replies; 7+ messages in thread
From: Veaceslav Falico @ 2013-11-01 10:41 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jay Vosburgh, Andy Gospodarek, netdev, kernel-janitors,
	Jiri Pirko

On Fri, Nov 01, 2013 at 01:18:44PM +0300, Dan Carpenter wrote:
>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 <dan.carpenter@oracle.com>

Hrm, how does it even build. Good catch, thanks.

Acked-by: Veaceslav Falico <vfalico@redhat.com>

>
>diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
>index 7661261..40e7b1c 100644
>--- a/drivers/net/bonding/bond_netlink.c
>+++ b/drivers/net/bonding/bond_netlink.c
>@@ -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,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch -next] bonding: bond_get_size() returns wrong size
  2013-11-01 10:41 ` Veaceslav Falico
@ 2013-11-01 10:52   ` Eric Dumazet
  2013-11-01 11:35   ` Jiri Pirko
  1 sibling, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2013-11-01 10:52 UTC (permalink / raw)
  To: Veaceslav Falico
  Cc: Dan Carpenter, Jay Vosburgh, Andy Gospodarek, netdev,
	kernel-janitors, Jiri Pirko

On Fri, 2013-11-01 at 11:41 +0100, Veaceslav Falico wrote:
> On Fri, Nov 01, 2013 at 01:18:44PM +0300, Dan Carpenter wrote:
> >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 <dan.carpenter@oracle.com>
> 
> Hrm, how does it even build. Good catch, thanks.
> 
> Acked-by: Veaceslav Falico <vfalico@redhat.com>

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'

 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch -next] bonding: bond_get_size() returns wrong size
  2013-11-01 10:41 ` Veaceslav Falico
  2013-11-01 10:52   ` Eric Dumazet
@ 2013-11-01 11:35   ` Jiri Pirko
  2013-11-01 12:25     ` Nikolay Aleksandrov
  1 sibling, 1 reply; 7+ messages in thread
From: Jiri Pirko @ 2013-11-01 11:35 UTC (permalink / raw)
  To: Veaceslav Falico
  Cc: Dan Carpenter, Jay Vosburgh, Andy Gospodarek, netdev,
	kernel-janitors

Fri, Nov 01, 2013 at 11:41:00AM CET, vfalico@redhat.com wrote:
>On Fri, Nov 01, 2013 at 01:18:44PM +0300, Dan Carpenter wrote:
>>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 <dan.carpenter@oracle.com>
>
>Hrm, how does it even build. Good catch, thanks.

I wonder about the same thing.


Reviewed-by: Jiri Pirko <jiri@resnulli.us>


>
>Acked-by: Veaceslav Falico <vfalico@redhat.com>
>
>>
>>diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
>>index 7661261..40e7b1c 100644
>>--- a/drivers/net/bonding/bond_netlink.c
>>+++ b/drivers/net/bonding/bond_netlink.c
>>@@ -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,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch -next] bonding: bond_get_size() returns wrong size
  2013-11-01 11:35   ` Jiri Pirko
@ 2013-11-01 12:25     ` Nikolay Aleksandrov
  2013-11-01 12:30       ` walter harms
  0 siblings, 1 reply; 7+ messages in thread
From: Nikolay Aleksandrov @ 2013-11-01 12:25 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: Veaceslav Falico, Dan Carpenter, Jay Vosburgh, Andy Gospodarek,
	netdev, kernel-janitors

On 11/01/2013 12:35 PM, Jiri Pirko wrote:
> Fri, Nov 01, 2013 at 11:41:00AM CET, vfalico@redhat.com wrote:
>> On Fri, Nov 01, 2013 at 01:18:44PM +0300, Dan Carpenter wrote:
>>> 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 <dan.carpenter@oracle.com>
>>
>> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch -next] bonding: bond_get_size() returns wrong size
  2013-11-01 12:25     ` Nikolay Aleksandrov
@ 2013-11-01 12:30       ` walter harms
  0 siblings, 0 replies; 7+ messages in thread
From: walter harms @ 2013-11-01 12:30 UTC (permalink / raw)
  To: Nikolay Aleksandrov
  Cc: Jiri Pirko, Veaceslav Falico, Dan Carpenter, Jay Vosburgh,
	Andy Gospodarek, netdev, kernel-janitors



Am 01.11.2013 13:25, schrieb Nikolay Aleksandrov:
> On 11/01/2013 12:35 PM, Jiri Pirko wrote:
>> Fri, Nov 01, 2013 at 11:41:00AM CET, vfalico@redhat.com wrote:
>>> On Fri, Nov 01, 2013 at 01:18:44PM +0300, Dan Carpenter wrote:
>>>> 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 <dan.carpenter@oracle.com>
>>>
>>> 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

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch -next] bonding: bond_get_size() returns wrong size
  2013-11-01 10:18 [patch -next] bonding: bond_get_size() returns wrong size Dan Carpenter
  2013-11-01 10:41 ` Veaceslav Falico
@ 2013-11-02  6:09 ` David Miller
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2013-11-02  6:09 UTC (permalink / raw)
  To: dan.carpenter; +Cc: fubar, vfalico, andy, netdev, kernel-janitors, jiri

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 1 Nov 2013 13:18:44 +0300

> 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 <dan.carpenter@oracle.com>

Applied, thanks a lot Dan.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-02  6:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-01 10:18 [patch -next] bonding: bond_get_size() returns wrong size Dan Carpenter
2013-11-01 10:41 ` Veaceslav Falico
2013-11-01 10:52   ` Eric Dumazet
2013-11-01 11:35   ` Jiri Pirko
2013-11-01 12:25     ` Nikolay Aleksandrov
2013-11-01 12:30       ` walter harms
2013-11-02  6:09 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).