Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1386954 > unrolled thread

[PATCH] net: dsa: mv88e6xxx: fix uninitialized error return

Started byColin King <colin.king@canonical.com>
First post2016-04-26 00:20 +0200
Last post2016-04-26 03:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] net: dsa: mv88e6xxx: fix uninitialized error return Colin King <colin.king@canonical.com> - 2016-04-26 00:20 +0200
    Re: [PATCH] net: dsa: mv88e6xxx: fix uninitialized error return Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-04-26 03:30 +0200

#1386954 — [PATCH] net: dsa: mv88e6xxx: fix uninitialized error return

FromColin King <colin.king@canonical.com>
Date2016-04-26 00:20 +0200
Subject[PATCH] net: dsa: mv88e6xxx: fix uninitialized error return
Message-ID<rrX1g-4VT-23@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

The error return err is not initialized and there is a possibility
that err is not assigned causing mv88e6xxx_port_bridge_join to
return a garbage error return status. Fix this by initializing err
to 0.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/dsa/mv88e6xxx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index 028f92f..98d3cfb 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -2207,7 +2207,7 @@ int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
 			       struct net_device *bridge)
 {
 	struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
-	int i, err;
+	int i, err = 0;
 
 	mutex_lock(&ps->smi_mutex);
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1387055

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2016-04-26 03:30 +0200
Message-ID<rrZZ7-7nE-1@gated-at.bofh.it>
In reply to#1386954
Hi Colin,

Colin King <colin.king@canonical.com> writes:

> From: Colin Ian King <colin.king@canonical.com>
>
> The error return err is not initialized and there is a possibility
> that err is not assigned causing mv88e6xxx_port_bridge_join to
> return a garbage error return status. Fix this by initializing err
> to 0.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Even though that cannot happen, the fix doesn't hurt.
Adding Geert in the loop who submitted an RFC for this first:

    https://lkml.org/lkml/2016/4/25/95

Thanks,

        Vivien

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web