netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [smatch] re: bonding:delete lacp_fast from ad_bond_info
@ 2011-06-11  8:12 Dan Carpenter
  2011-06-13 14:30 ` [PATCH] bonding:delete a dereference before check Weiping Pan
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2011-06-11  8:12 UTC (permalink / raw)
  To: panweiping3; +Cc: open list:BONDING DRIVER

There was a dereference before a check added in 56d00c677de0a
"bonding:delete lacp_fast from ad_bond_info"

drivers/net/bonding/bond_3ad.c +1907 bond_3ad_bind_slave(7)
	warn: variable dereferenced before check 'bond'

  1900  int bond_3ad_bind_slave(struct slave *slave)
  1901  {
  1902          struct bonding *bond = bond_get_bond_by_slave(slave);
  1903          int lacp_fast = bond->params.lacp_fast;
                                ^^^^^^^^^^^^
	dereference.

  1904          struct port *port;
  1905          struct aggregator *aggregator;
  1906  
  1907          if (bond == NULL) {
                    ^^^^^^^^^^^^
	check.

  1908                  pr_err("%s: The slave %s is not attached to its bond\n",
  1909                         slave->dev->master->name, slave->dev->name);
  1910                  return -1;
  1911          }

regards,
dan carpenter

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

* [PATCH] bonding:delete a dereference before check
  2011-06-11  8:12 [smatch] re: bonding:delete lacp_fast from ad_bond_info Dan Carpenter
@ 2011-06-13 14:30 ` Weiping Pan
  2011-06-13 22:11   ` Jay Vosburgh
  0 siblings, 1 reply; 4+ messages in thread
From: Weiping Pan @ 2011-06-13 14:30 UTC (permalink / raw)
  To: error27
  Cc: Weiping Pan, Jay Vosburgh, Andy Gospodarek,
	open list:BONDING DRIVER, open list

Dan Carpenter found that there was a dereference before a check,
added in 56d00c677de0(bonding:delete lacp_fast from ad_bond_info).

Signed-off-by: Weiping Pan <panweiping3@gmail.com>
---
 drivers/net/bonding/bond_3ad.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 6122725..77da2e8 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -1900,7 +1900,6 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
 int bond_3ad_bind_slave(struct slave *slave)
 {
 	struct bonding *bond = bond_get_bond_by_slave(slave);
-	int lacp_fast = bond->params.lacp_fast;
 	struct port *port;
 	struct aggregator *aggregator;
 
@@ -1916,7 +1915,7 @@ int bond_3ad_bind_slave(struct slave *slave)
 		// port initialization
 		port = &(SLAVE_AD_INFO(slave).port);
 
-		ad_initialize_port(port, lacp_fast);
+		ad_initialize_port(port, bond->params.lacp_fast);
 
 		port->slave = slave;
 		port->actor_port_number = SLAVE_AD_INFO(slave).id;
-- 
1.7.4.4

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

* Re: [PATCH] bonding:delete a dereference before check
  2011-06-13 14:30 ` [PATCH] bonding:delete a dereference before check Weiping Pan
@ 2011-06-13 22:11   ` Jay Vosburgh
  2011-06-13 22:29     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Jay Vosburgh @ 2011-06-13 22:11 UTC (permalink / raw)
  To: Weiping Pan; +Cc: error27, Andy Gospodarek, open list:BONDING DRIVER, open list

Weiping Pan <panweiping3@gmail.com> wrote:

>Dan Carpenter found that there was a dereference before a check,
>added in 56d00c677de0(bonding:delete lacp_fast from ad_bond_info).
>
>Signed-off-by: Weiping Pan <panweiping3@gmail.com>

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

	-J

> drivers/net/bonding/bond_3ad.c |    3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>index 6122725..77da2e8 100644
>--- a/drivers/net/bonding/bond_3ad.c
>+++ b/drivers/net/bonding/bond_3ad.c
>@@ -1900,7 +1900,6 @@ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
> int bond_3ad_bind_slave(struct slave *slave)
> {
> 	struct bonding *bond = bond_get_bond_by_slave(slave);
>-	int lacp_fast = bond->params.lacp_fast;
> 	struct port *port;
> 	struct aggregator *aggregator;
>
>@@ -1916,7 +1915,7 @@ int bond_3ad_bind_slave(struct slave *slave)
> 		// port initialization
> 		port = &(SLAVE_AD_INFO(slave).port);
>
>-		ad_initialize_port(port, lacp_fast);
>+		ad_initialize_port(port, bond->params.lacp_fast);
>
> 		port->slave = slave;
> 		port->actor_port_number = SLAVE_AD_INFO(slave).id;
>-- 
>1.7.4.4

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

* Re: [PATCH] bonding:delete a dereference before check
  2011-06-13 22:11   ` Jay Vosburgh
@ 2011-06-13 22:29     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-06-13 22:29 UTC (permalink / raw)
  To: fubar; +Cc: panweiping3, error27, andy, netdev, linux-kernel

From: Jay Vosburgh <fubar@us.ibm.com>
Date: Mon, 13 Jun 2011 15:11:01 -0700

> Weiping Pan <panweiping3@gmail.com> wrote:
> 
>>Dan Carpenter found that there was a dereference before a check,
>>added in 56d00c677de0(bonding:delete lacp_fast from ad_bond_info).
>>
>>Signed-off-by: Weiping Pan <panweiping3@gmail.com>
> 
> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

Applied, thanks.

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

end of thread, other threads:[~2011-06-13 22:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-11  8:12 [smatch] re: bonding:delete lacp_fast from ad_bond_info Dan Carpenter
2011-06-13 14:30 ` [PATCH] bonding:delete a dereference before check Weiping Pan
2011-06-13 22:11   ` Jay Vosburgh
2011-06-13 22:29     ` 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).