Message ID | 1467176548-40488-2-git-send-email-u9012063@gmail.com |
---|---|
State | Rejected |
Headers | show |
On Tue, Jun 28, 2016 at 10:02:22PM -0700, William Tu wrote: > Signed-off-by: William Tu <u9012063@gmail.com> > --- > vswitchd/bridge.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c > index 8ebfc66..7244e11 100644 > --- a/vswitchd/bridge.c > +++ b/vswitchd/bridge.c > @@ -1999,7 +1999,7 @@ find_local_hw_addr(const struct bridge *br, struct eth_addr *ea, > > /* The local port doesn't count (since we're trying to choose its > * MAC address anyway). */ > - if (iface->ofp_port == OFPP_LOCAL) { > + if (iface && iface->ofp_port == OFPP_LOCAL) { > continue; > } A port is guaranteed to have at least one interface, so 'iface' can't be null here. Even if it could, this patch wouldn't help because a few lines down there's an unconditional dereference. I'd happily add an assertion to document this, e.g.: http://openvswitch.org/pipermail/dev/2016-July/074352.html
Hi Ben, Thanks, I tested your patch below and clang no longer reports no error. Regards, William > A port is guaranteed to have at least one interface, so 'iface' can't be > null here. Even if it could, this patch wouldn't help because a few > lines down there's an unconditional dereference. > > I'd happily add an assertion to document this, e.g.: > http://openvswitch.org/pipermail/dev/2016-July/074352.html
Thanks, applied to master. On Tue, Jul 05, 2016 at 06:54:41AM -0700, William Tu wrote: > Hi Ben, > > Thanks, I tested your patch below and clang no longer reports no error. > > Regards, > William > > > A port is guaranteed to have at least one interface, so 'iface' can't be > > null here. Even if it could, this patch wouldn't help because a few > > lines down there's an unconditional dereference. > > > > I'd happily add an assertion to document this, e.g.: > > http://openvswitch.org/pipermail/dev/2016-July/074352.html
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 8ebfc66..7244e11 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -1999,7 +1999,7 @@ find_local_hw_addr(const struct bridge *br, struct eth_addr *ea, /* The local port doesn't count (since we're trying to choose its * MAC address anyway). */ - if (iface->ofp_port == OFPP_LOCAL) { + if (iface && iface->ofp_port == OFPP_LOCAL) { continue; }
Signed-off-by: William Tu <u9012063@gmail.com> --- vswitchd/bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)