Skip to content

Commit

Permalink
vtep-ctl: Remove extraneous NULL pointer check.
Browse files Browse the repository at this point in the history
OVS will exit if the allocations in this function fail, so this check is
pointless.

Found by MIT STACK undefined behaviour checker.

Signed-off-by: Joe Stringer <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
joestringer committed Jul 17, 2015
1 parent a805558 commit e8eba0a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions vtep/vtep-ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ del_cached_port(struct vtep_ctl_context *vtepctl_ctx,
free(port);
}

static struct vtep_ctl_pswitch *
static void
add_pswitch_to_cache(struct vtep_ctl_context *vtepctl_ctx,
struct vteprec_physical_switch *ps_cfg)
{
Expand All @@ -504,7 +504,6 @@ add_pswitch_to_cache(struct vtep_ctl_context *vtepctl_ctx,
ps->name = xstrdup(ps_cfg->name);
list_init(&ps->ports);
shash_add(&vtepctl_ctx->pswitches, ps->name, ps);
return ps;
}

static void
Expand Down Expand Up @@ -837,18 +836,14 @@ vtep_ctl_context_populate_cache(struct ctl_context *ctx)
sset_init(&ports);
for (i = 0; i < vtep_global->n_switches; i++) {
struct vteprec_physical_switch *ps_cfg = vtep_global->switches[i];
struct vtep_ctl_pswitch *ps;
size_t j;

if (!sset_add(&pswitches, ps_cfg->name)) {
VLOG_WARN("%s: database contains duplicate physical switch name",
ps_cfg->name);
continue;
}
ps = add_pswitch_to_cache(vtepctl_ctx, ps_cfg);
if (!ps) {
continue;
}
add_pswitch_to_cache(vtepctl_ctx, ps_cfg);

for (j = 0; j < ps_cfg->n_ports; j++) {
struct vteprec_physical_port *port_cfg = ps_cfg->ports[j];
Expand Down

0 comments on commit e8eba0a

Please sign in to comment.