netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Richard Alpe <richard.alpe@ericsson.com>, netdev@vger.kernel.org
Subject: [iproute PATCH] tipc: Drop unused variable 'genl'
Date: Thu, 18 Oct 2018 15:48:09 +0200	[thread overview]
Message-ID: <20181018134809.843-1-phil@nwl.cc> (raw)

Although initialized by call to libmnl, the variable is used only in a
call to sizeof(). Drop it and call sizeof with its type instead.

Fixes: f043759dd4928 ("tipc: add new TIPC configuration tool")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 tipc/node.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tipc/node.c b/tipc/node.c
index 0fa1064c72a17..2fec6753c974d 100644
--- a/tipc/node.c
+++ b/tipc/node.c
@@ -26,13 +26,12 @@
 
 static int node_list_cb(const struct nlmsghdr *nlh, void *data)
 {
-	struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
 	struct nlattr *info[TIPC_NLA_MAX + 1] = {};
 	struct nlattr *attrs[TIPC_NLA_NODE_MAX + 1] = {};
 	char str[33] = {};
 	uint32_t addr;
 
-	mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info);
+	mnl_attr_parse(nlh, sizeof(struct genlmsghdr), parse_attrs, info);
 	if (!info[TIPC_NLA_NODE])
 		return MNL_CB_ERROR;
 
@@ -160,7 +159,6 @@ static int cmd_node_set_nodeid(struct nlmsghdr *nlh, const struct cmd *cmd,
 
 static int nodeid_get_cb(const struct nlmsghdr *nlh, void *data)
 {
-	struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
 	struct nlattr *info[TIPC_NLA_MAX + 1] = {};
 	struct nlattr *attrs[TIPC_NLA_NET_MAX + 1] = {};
 	char str[33] = {0,};
@@ -168,7 +166,7 @@ static int nodeid_get_cb(const struct nlmsghdr *nlh, void *data)
 	uint64_t *w0 = (uint64_t *) &id[0];
 	uint64_t *w1 = (uint64_t *) &id[8];
 
-	mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info);
+	mnl_attr_parse(nlh, sizeof(struct genlmsghdr), parse_attrs, info);
 	if (!info[TIPC_NLA_NET])
 		return MNL_CB_ERROR;
 
@@ -207,11 +205,10 @@ static int cmd_node_get_nodeid(struct nlmsghdr *nlh, const struct cmd *cmd,
 
 static int netid_get_cb(const struct nlmsghdr *nlh, void *data)
 {
-	struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
 	struct nlattr *info[TIPC_NLA_MAX + 1] = {};
 	struct nlattr *attrs[TIPC_NLA_NET_MAX + 1] = {};
 
-	mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info);
+	mnl_attr_parse(nlh, sizeof(struct genlmsghdr), parse_attrs, info);
 	if (!info[TIPC_NLA_NET])
 		return MNL_CB_ERROR;
 
-- 
2.19.0

             reply	other threads:[~2018-10-18 21:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 13:48 Phil Sutter [this message]
2018-10-22 17:08 ` [iproute PATCH] tipc: Drop unused variable 'genl' Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181018134809.843-1-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netdev@vger.kernel.org \
    --cc=richard.alpe@ericsson.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).