public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Engelhardt <jengelh@inai.de>
To: simran singhal <singhalsimran0@gmail.com>
Cc: pablo@netfilter.org, kadlec@blackhole.kfki.hu,
	davem@davemloft.net, netfilter-devel@vger.kernel.org,
	coreteam@netfilter.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, outreachy-kernel@googlegroups.com,
	gregkh@linuxfoundation.org,
	Stephen Hemminger <stephen@networkplumber.org>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	James Morris <jmorris@namei.org>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Patrick McHardy <kaber@trash.net>,
	bridge@lists.linux-foundation.org
Subject: Re: [PATCH] net: Remove unnecessary cast on void pointer
Date: Tue, 28 Mar 2017 15:51:05 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LSU.2.20.1703281548580.21255@n3.vanv.qr> (raw)
In-Reply-To: <20170328125048.GA25091@singhal-Inspiron-5558>

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@gmail.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.

  reply	other threads:[~2017-03-28 13:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 12:50 [PATCH] net: Remove unnecessary cast on void pointer simran singhal
2017-03-28 13:51 ` Jan Engelhardt [this message]
2017-03-28 15:33 ` [Outreachy kernel] " Julia Lawall

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=alpine.LSU.2.20.1703281548580.21255@n3.vanv.qr \
    --to=jengelh@inai.de \
    --cc=bridge@lists.linux-foundation.org \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=pablo@netfilter.org \
    --cc=singhalsimran0@gmail.com \
    --cc=stephen@networkplumber.org \
    --cc=yoshfuji@linux-ipv6.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