Subject: Re: [PATCH net-next v2] bonding: uninitialized variable in bond_miimon_inspect()

From: Jay Vosburgh <[email-masked]>
Date: Mon, 28 Nov 2022 10:30:15 -0800

Dan Carpenter <[email-masked]> wrote:

>The "ignore_updelay" variable needs to be initialized to false.
>
>Fixes: f8a65ab2f3ff ("bonding: fix link recovery in mode 2 when updelay is nonzero")
>Signed-off-by: Dan Carpenter <[email-masked]>

Acked-by: Jay Vosburgh <[email-masked]>

>---
>v2: Re-order so the declarations are in reverse Christmas tree order
>
>Don't forget about:
>drivers/net/bonding/bond_main.c:5071 bond_update_slave_arr() warn: missing error code here? 'bond_3ad_get_active_agg_info()' failed. 'ret' = '0'

	The code around the cited line is correct.  A -1 return from
bond_3ad_get_active_agg_info is not indicative of an error in the sense
that something has failed, but indicates that there is no active
aggregator.  The code correctly returns 0 from bond_update_slave_arr, as
returning non-zero would cause bond_slave_arr_handler to loop, retrying
the call to bond_update_slave_arr (via workqueue).

	-J

> drivers/net/bonding/bond_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index c87481033995..e01bb0412f1c 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -2524,10 +2524,10 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
> /* called with rcu_read_lock() */
> static int bond_miimon_inspect(struct bonding *bond)
> {
>+	bool ignore_updelay = false;
> 	int link_state, commit = 0;
> 	struct list_head *iter;
> 	struct slave *slave;
>-	bool ignore_updelay;
> 
> 	if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) {
> 		ignore_updelay = !rcu_dereference(bond->curr_active_slave);
>-- 
>2.35.1
>

---
	-Jay Vosburgh, [email-masked]