diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-08-14 08:31:01 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-08-14 08:31:01 +0000 |
commit | 69d06aa84f4ab6b27dd0448bf0640684b7360edd (patch) | |
tree | 401cfa8f84ca2f9dbc1e974eda331c6c378f6397 /sys | |
parent | bfdc1c120d31850163e188ab00f46b5b09f63fb1 (diff) |
The "ret" return value is reused and overwritten, potentially
returning 0 (success) on error instead of an error number. The caller
doesn't evaluate the return value, so it is good enough to return
ENOBUFS (non-0) on error and to remove "ret" in trunk_cast_start().
Coverity CID 1453105; Severity: Minor
OK mpi@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_trunk.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c index 7b2c6ad676c..3b27c0399ac 100644 --- a/sys/net/if_trunk.c +++ b/sys/net/if_trunk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.c,v 1.133 2017/08/11 21:24:19 mpi Exp $ */ +/* $OpenBSD: if_trunk.c,v 1.134 2017/08/14 08:31:00 reyk Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -1491,7 +1491,6 @@ trunk_bcast_start(struct trunk_softc *tr, struct mbuf *m0) { int active_ports = 0; int errors = 0; - int ret; struct trunk_port *tp, *last = NULL; struct mbuf *m; @@ -1504,13 +1503,11 @@ trunk_bcast_start(struct trunk_softc *tr, struct mbuf *m0) if (last != NULL) { m = m_copym(m0, 0, M_COPYALL, M_DONTWAIT); if (m == NULL) { - ret = ENOBUFS; errors++; break; } - ret = if_enqueue(last->tp_if, m); - if (ret != 0) + if (if_enqueue(last->tp_if, m) != 0) errors++; } last = tp; @@ -1520,12 +1517,11 @@ trunk_bcast_start(struct trunk_softc *tr, struct mbuf *m0) return (ENOENT); } - ret = if_enqueue(last->tp_if, m0); - if (ret != 0) + if (if_enqueue(last->tp_if, m0) != 0) errors++; if (errors == active_ports) - return (ret); + return (ENOBUFS); return (0); } |