From a76a315bdf5a15432d1e03bd46aee854215eabd4 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 5 Mar 2009 10:46:33 -0800 Subject: [PATCH] dpif: Fix uninitialized memory accesses. Found by Valgrind. This may fix some problems found by Dan. --- lib/dpif.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/dpif.c b/lib/dpif.c index 0c94de41..eba08551 100644 --- a/lib/dpif.c +++ b/lib/dpif.c @@ -82,18 +82,17 @@ static char *odp_actions_to_string(const union odp_action actions[], int dpif_open(const char *name, struct dpif *dpif) { - unsigned int minor; int listen_mask; int error; dpif->fd = -1; - error = name_to_minor(name, &minor); + error = name_to_minor(name, &dpif->minor); if (error) { return error; } - error = open_by_minor(minor, dpif); + error = open_by_minor(dpif->minor, dpif); if (error) { return error; } @@ -101,11 +100,12 @@ dpif_open(const char *name, struct dpif *dpif) /* We can open the device, but that doesn't mean that it's been created. * If it hasn't been, then any command other than ODP_DP_CREATE will * return ENODEV. Try something innocuous. */ + listen_mask = 0; /* Make Valgrind happy. */ if (ioctl(dpif->fd, ODP_GET_LISTEN_MASK, &listen_mask)) { error = errno; if (error != ENODEV) { VLOG_WARN("dp%u: probe returned unexpected error: %s", - minor, strerror(error)); + dpif->minor, strerror(error)); } dpif_close(dpif); return error; -- 2.30.2