netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: [libnftnl PATCH 2/6] src/gen: Remove a pointless call to mnl_nlmsg_get_payload()
Date: Thu, 14 Dec 2017 20:40:21 +0100	[thread overview]
Message-ID: <20171214194025.21334-3-phil@nwl.cc> (raw)
In-Reply-To: <20171214194025.21334-1-phil@nwl.cc>

It is a common idiom in all *_nlmsg_parse() functions, but
nftnl_gen_nlmsg_parse() doesn't make use of the data pointer and the
compiler probably can't eliminate it since there could be a side-effect.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/gen.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gen.c b/src/gen.c
index 58b3a96dbdcb9..eafb015a25345 100644
--- a/src/gen.c
+++ b/src/gen.c
@@ -143,9 +143,9 @@ static int nftnl_gen_parse_attr_cb(const struct nlattr *attr, void *data)
 int nftnl_gen_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_gen *gen)
 {
 	struct nlattr *tb[NFTA_GEN_MAX + 1] = {};
-	struct nfgenmsg *nfg = mnl_nlmsg_get_payload(nlh);
 
-	if (mnl_attr_parse(nlh, sizeof(*nfg), nftnl_gen_parse_attr_cb, tb) < 0)
+	if (mnl_attr_parse(nlh, sizeof(struct nfgenmsg),
+			   nftnl_gen_parse_attr_cb, tb) < 0)
 		return -1;
 
 	if (tb[NFTA_GEN_ID]) {
-- 
2.13.1


  parent reply	other threads:[~2017-12-14 19:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 19:40 [libnftnl PATCH 0/6] Another round of Covscan indicated fixes Phil Sutter
2017-12-14 19:40 ` [libnftnl PATCH 1/6] nftnl_data_reg_snprintf: Add a missing break Phil Sutter
2017-12-15 15:17   ` Pablo Neira Ayuso
2017-12-14 19:40 ` Phil Sutter [this message]
2017-12-15 15:17   ` [libnftnl PATCH 2/6] src/gen: Remove a pointless call to mnl_nlmsg_get_payload() Pablo Neira Ayuso
2017-12-14 19:40 ` [libnftnl PATCH 3/6] src/object: Avoid returning garbage in nftnl_obj_do_parse() Phil Sutter
2017-12-15 15:18   ` Pablo Neira Ayuso
2017-12-14 19:40 ` [libnftnl PATCH 4/6] src/ruleset: Avoid reading garbage in nftnl_ruleset_cb() Phil Sutter
2017-12-15 15:18   ` Pablo Neira Ayuso
2017-12-14 19:40 ` [libnftnl PATCH 5/6] src/set_elem: Don't return garbage in nftnl_set_elems_parse() Phil Sutter
2017-12-15 15:19   ` Pablo Neira Ayuso
2017-12-14 19:40 ` [libnftnl PATCH 6/6] src/trace: Check return value of mnl_attr_parse_nested() Phil Sutter
2017-12-15 15:20   ` Pablo Neira Ayuso

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=20171214194025.21334-3-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).