lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sat, 04 Jan 2014 01:29:13 +0100
From:	Michal Nazarewicz <mina86@...a86.com>
To:	Pablo Neira Ayuso <pablo@...filter.org>
Cc:	Patrick McHardy <kaber@...sh.net>,
	Jozsef Kadlecsik <kadlec@...ckhole.kfki.hu>,
	"David S. Miller" <davem@...emloft.net>,
	netfilter-devel@...r.kernel.org, netfilter@...r.kernel.org,
	coreteam@...filter.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH RESEND] netfilter: remove unused variable

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@...a86.com>
>> Cc: Patrick McHardy <kaber@...sh.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@...gle.com>--<xmpp:mina86@...ber.org>--ooO--(_)--Ooo--


Download attachment "signature.asc" of type "application/pgp-signature" (836 bytes)

Powered by blists - more mailing lists