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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.20.1703281548580.21255@n3.vanv.qr>
Date:   Tue, 28 Mar 2017 15:51:05 +0200 (CEST)
From:   Jan Engelhardt <jengelh@...i.de>
To:     simran singhal <singhalsimran0@...il.com>
cc:     pablo@...filter.org, kadlec@...ckhole.kfki.hu, davem@...emloft.net,
        netfilter-devel@...r.kernel.org, coreteam@...filter.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        outreachy-kernel@...glegroups.com, gregkh@...uxfoundation.org,
        Stephen Hemminger <stephen@...workplumber.org>,
        Alexey Kuznetsov <kuznet@....inr.ac.ru>,
        James Morris <jmorris@...ei.org>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        Patrick McHardy <kaber@...sh.net>,
        bridge@...ts.linux-foundation.org
Subject: Re: [PATCH] net: Remove unnecessary cast on void pointer

On Tuesday 2017-03-28 14:50, simran singhal wrote:

>The following Coccinelle script was used to detect this:
>@r@
>expression x;
>void* e;
>type T;
>identifier f;
>@@
>(
>  *((T *)e)
>|
>  ((T *)x)[...]
>|
>  ((T*)x)->f
>|
>
>- (T*)
>  e
>)
>
>Signed-off-by: simran singhal <singhalsimran0@...il.com>
>---
> net/bridge/netfilter/ebtables.c         |  2 +-
> net/ipv4/netfilter/arp_tables.c         | 20 ++++++++------------
> net/ipv4/netfilter/ip_tables.c          | 20 ++++++++------------
> net/ipv6/netfilter/ip6_tables.c         | 20 ++++++++------------
> net/netfilter/ipset/ip_set_bitmap_gen.h |  4 ++--
> net/netfilter/ipset/ip_set_core.c       |  2 +-
> net/netfilter/nf_conntrack_proto.c      |  2 +-
> net/netfilter/nft_set_hash.c            |  2 +-
> net/netfilter/xt_hashlimit.c            | 10 +++++-----
> 9 files changed, 35 insertions(+), 47 deletions(-)
>
>diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
>index 79b6991..bdc629e 100644
>--- a/net/bridge/netfilter/ebtables.c
>+++ b/net/bridge/netfilter/ebtables.c
>@@ -1713,7 +1713,7 @@ static int compat_copy_entry_to_user(struct ebt_entry *e, void __user **dstptr,
> 	if (*size < sizeof(*ce))
> 		return -EINVAL;
> 
>-	ce = (struct ebt_entry __user *)*dstptr;
>+	ce = *dstptr;
> 	if (copy_to_user(ce, e, sizeof(*ce)))
> 		return -EFAULT;
> 
>diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
>index 6241a81..f046c12 100644
>--- a/net/ipv4/netfilter/arp_tables.c
>+++ b/net/ipv4/netfilter/arp_tables.c
>@@ -310,7 +310,7 @@ static int mark_source_chains(const struct xt_table_info *newinfo,
> 	for (hook = 0; hook < NF_ARP_NUMHOOKS; hook++) {
> 		unsigned int pos = newinfo->hook_entry[hook];
> 		struct arpt_entry *e
>-			= (struct arpt_entry *)(entry0 + pos);
>+			= (entry0 + pos);

At this point you can also drop the now-unnecessary parentheses in all 
the lines you changed.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ