From c837a18ced48cac1ac221e8213a6851c6636476e Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Mon, 22 Jul 2019 17:34:25 +0200
Subject: [PATCH] gen: Remove a pointless call to mnl_nlmsg_get_payload()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1510538
Upstream Status: libnftnl commit fd9ab5c922cd8
commit fd9ab5c922cd8d15e8f0251c70bcd9532158e9b0
Author: Phil Sutter <phil@nwl.cc>
Date: Thu Dec 14 20:40:21 2017 +0100
gen: Remove a pointless call to mnl_nlmsg_get_payload()
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>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/gen.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gen.c b/src/gen.c
index 58b3a96..eafb015 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]) {
--
1.8.3.1