* [PATCH net-next] bonding: uninitialized variable in bond_miimon_inspect()
@ 2022-11-28 8:20 Dan Carpenter
2022-11-28 8:44 ` Pavan Chebbi
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-11-28 8:20 UTC (permalink / raw)
To: Jay Vosburgh, Jonathan Toppins
Cc: Veaceslav Falico, Andy Gospodarek, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, kernel-janitors
The "ignore_updelay" variable needs to be initialized to false to
prevent an uninitialized variable bug.
Fixes: f8a65ab2f3ff ("bonding: fix link recovery in mode 2 when updelay is nonzero")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
This was found by Smatch. Another Smatch warning that might be worth
investigating is:
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'
I don't know the code well enough to say if that's a real bug.
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..8a57a5681461 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2527,7 +2527,7 @@ static int bond_miimon_inspect(struct bonding *bond)
int link_state, commit = 0;
struct list_head *iter;
struct slave *slave;
- bool ignore_updelay;
+ bool ignore_updelay = false;
if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) {
ignore_updelay = !rcu_dereference(bond->curr_active_slave);
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] bonding: uninitialized variable in bond_miimon_inspect()
2022-11-28 8:20 [PATCH net-next] bonding: uninitialized variable in bond_miimon_inspect() Dan Carpenter
@ 2022-11-28 8:44 ` Pavan Chebbi
0 siblings, 0 replies; 2+ messages in thread
From: Pavan Chebbi @ 2022-11-28 8:44 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jay Vosburgh, Jonathan Toppins, Veaceslav Falico,
Andy Gospodarek, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, netdev, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]
On Mon, Nov 28, 2022 at 1:51 PM Dan Carpenter <error27@gmail.com> wrote:
>
> The "ignore_updelay" variable needs to be initialized to false to
> prevent an uninitialized variable bug.
>
> Fixes: f8a65ab2f3ff ("bonding: fix link recovery in mode 2 when updelay is nonzero")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
>
> This was found by Smatch. Another Smatch warning that might be worth
> investigating is:
>
> 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'
>
> I don't know the code well enough to say if that's a real bug.
>
> 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..8a57a5681461 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -2527,7 +2527,7 @@ static int bond_miimon_inspect(struct bonding *bond)
> int link_state, commit = 0;
> struct list_head *iter;
> struct slave *slave;
> - bool ignore_updelay;
> + bool ignore_updelay = false;
Looks good to me. But can we have the declaration follow the reverse
xmas tree ordering?
Thanks
>
> if (BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP) {
> ignore_updelay = !rcu_dereference(bond->curr_active_slave);
> --
> 2.35.1
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-28 8:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28 8:20 [PATCH net-next] bonding: uninitialized variable in bond_miimon_inspect() Dan Carpenter
2022-11-28 8:44 ` Pavan Chebbi
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).