* [PATCH RESEND] netfilter: remove unused variable @ 2014-01-01 5:27 Michal Nazarewicz 2014-01-03 23:11 ` Pablo Neira Ayuso 0 siblings, 1 reply; 3+ messages in thread From: Michal Nazarewicz @ 2014-01-01 5:27 UTC (permalink / raw) To: Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik, David S. Miller Cc: netfilter-devel, netfilter, coreteam, netdev, linux-kernel, Michal Nazarewicz The nfmsg variable is not used (except in sizeof operator which does not care about its value) between the first and second time it is assigned the value. Furthermore, nlmsg_data has no side effects, so the assignment can be safely removed. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Cc: Patrick McHardy <kaber@trash.net> --- net/netfilter/nf_tables_api.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index f93b7d0..9c56adc 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -2521,7 +2521,6 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) u32 portid, seq; int event, err; - nfmsg = nlmsg_data(cb->nlh); err = nlmsg_parse(cb->nlh, sizeof(*nfmsg), nla, NFTA_SET_ELEM_LIST_MAX, nft_set_elem_list_policy); if (err < 0) -- 1.8.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] netfilter: remove unused variable 2014-01-01 5:27 [PATCH RESEND] netfilter: remove unused variable Michal Nazarewicz @ 2014-01-03 23:11 ` Pablo Neira Ayuso 2014-01-04 0:29 ` Michal Nazarewicz 0 siblings, 1 reply; 3+ messages in thread From: Pablo Neira Ayuso @ 2014-01-03 23:11 UTC (permalink / raw) To: Michal Nazarewicz Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller, netfilter-devel, netfilter, coreteam, netdev, linux-kernel On Wed, Jan 01, 2014 at 06:27:19AM +0100, Michal Nazarewicz wrote: > The nfmsg variable is not used (except in sizeof operator which does > not care about its value) between the first and second time it is > assigned the value. Furthermore, nlmsg_data has no side effects, so > the assignment can be safely removed. Applied with minor glitch, see below. Thanks. > Signed-off-by: Michal Nazarewicz <mina86@mina86.com> > Cc: Patrick McHardy <kaber@trash.net> > --- > net/netfilter/nf_tables_api.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c > index f93b7d0..9c56adc 100644 > --- a/net/netfilter/nf_tables_api.c > +++ b/net/netfilter/nf_tables_api.c > @@ -2521,7 +2521,6 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) > u32 portid, seq; > int event, err; > > - nfmsg = nlmsg_data(cb->nlh); > err = nlmsg_parse(cb->nlh, sizeof(*nfmsg), nla, NFTA_SET_ELEM_LIST_MAX, mangled this patch to use sizeof(struct nfgenmsg) instead. That change is not required from the semantic point of view, of course, but for readability reasons I think it's better not to refer to a variable that is not used in that context. > nft_set_elem_list_policy); > if (err < 0) > -- > 1.8.4 > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] netfilter: remove unused variable 2014-01-03 23:11 ` Pablo Neira Ayuso @ 2014-01-04 0:29 ` Michal Nazarewicz 0 siblings, 0 replies; 3+ messages in thread From: Michal Nazarewicz @ 2014-01-04 0:29 UTC (permalink / raw) To: Pablo Neira Ayuso Cc: Patrick McHardy, Jozsef Kadlecsik, David S. Miller, netfilter-devel, netfilter, coreteam, netdev, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1843 bytes --] On Sat, Jan 04 2014, Pablo Neira Ayuso wrote: > On Wed, Jan 01, 2014 at 06:27:19AM +0100, Michal Nazarewicz wrote: >> The nfmsg variable is not used (except in sizeof operator which does >> not care about its value) between the first and second time it is >> assigned the value. Furthermore, nlmsg_data has no side effects, so >> the assignment can be safely removed. > > Applied with minor glitch, see below. Thanks. > Thanks. > >> Signed-off-by: Michal Nazarewicz <mina86@mina86.com> >> Cc: Patrick McHardy <kaber@trash.net> >> --- >> net/netfilter/nf_tables_api.c | 1 - >> 1 file changed, 1 deletion(-) >> >> diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c >> index f93b7d0..9c56adc 100644 >> --- a/net/netfilter/nf_tables_api.c >> +++ b/net/netfilter/nf_tables_api.c >> @@ -2521,7 +2521,6 @@ static int nf_tables_dump_set(struct sk_buff *skb, struct netlink_callback *cb) >> u32 portid, seq; >> int event, err; >> >> - nfmsg = nlmsg_data(cb->nlh); >> err = nlmsg_parse(cb->nlh, sizeof(*nfmsg), nla, NFTA_SET_ELEM_LIST_MAX, > > mangled this patch to use sizeof(struct nfgenmsg) instead. That change > is not required from the semantic point of view, of course, but for > readability reasons I think it's better not to refer to a variable > that is not used in that context. Works for me, and err = nlmsg_parse(cb->nlh, sizeof(*nlmsg_data(cb->nlh)), nla, NFTA_SET_ELEM_LIST_MAX, nft_set_elem_list_policy); would probably be an overkill. ;) >> if (err < 0) >> -- >> 1.8.4 -- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz (o o) ooo +--<mpn@google.com>--<xmpp:mina86@jabber.org>--ooO--(_)--Ooo-- [-- Attachment #2.1: Type: text/plain, Size: 0 bytes --] [-- Attachment #2.2: signature.asc --] [-- Type: application/pgp-signature, Size: 835 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-04 0:29 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-01-01 5:27 [PATCH RESEND] netfilter: remove unused variable Michal Nazarewicz 2014-01-03 23:11 ` Pablo Neira Ayuso 2014-01-04 0:29 ` Michal Nazarewicz
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).