[ovs-dev] [PATCH v2] windows: Fix uninitialized variable in netlink-socket

Alin Serdean aserdean at cloudbasesolutions.com
Mon Mar 6 16:22:39 UTC 2017


From: Alin Serdean <aserdean at cloudbasesolutions.com>

The variable `request_nlmsg` was used without being initialized.

This patch assigns a value to it before being used.

Found by inspection.

Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
---
v2: Change commit title
---
 lib/netlink-socket.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index e45914c..7105b9b 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -886,6 +886,8 @@ nl_sock_transact_multiple__(struct nl_sock *sock,
         }
 
         if (reply_len != 0) {
+            request_nlmsg = nl_msg_nlmsghdr(txn->request);
+
             if (reply_len < sizeof *reply_nlmsg) {
                 nl_sock_record_errors__(transactions, n, 0);
                 VLOG_DBG_RL(&rl, "insufficient length of reply %#"PRIu32
@@ -894,7 +896,6 @@ nl_sock_transact_multiple__(struct nl_sock *sock,
             }
 
             /* Validate the sequence number in the reply. */
-            request_nlmsg = nl_msg_nlmsghdr(txn->request);
             reply_nlmsg = (struct nlmsghdr *)reply_buf;
 
             if (request_nlmsg->nlmsg_seq != reply_nlmsg->nlmsg_seq) {
-- 
2.10.2.windows.1


More information about the dev mailing list