Patchwork netfilter: use PTR_RET

login
register
mail settings
Submitter Wu Fengguang
Date Oct. 29, 2012, 12:40 a.m.
Message ID <20121029004044.GA12982@localhost>
Download mbox | patch
Permalink /patch/194768/
State Accepted
Headers show

Comments

Wu Fengguang - Oct. 29, 2012, 12:40 a.m.
Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR

Generated by: coccinelle/api/ptr_ret.cocci

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
---

 net/ipv4/netfilter/iptable_nat.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira - Oct. 29, 2012, 9:03 a.m.
On Mon, Oct 29, 2012 at 08:40:44AM +0800, Fengguang Wu wrote:
> Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR
> 
> Generated by: coccinelle/api/ptr_ret.cocci

Applied, thanks.

I have collapsed this patch and the one for ipv6/iptable_nat.c. They
are pretty small and description is the same.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wu Fengguang - Oct. 29, 2012, 9:13 a.m.
On Mon, Oct 29, 2012 at 10:03:47AM +0100, Pablo Neira Ayuso wrote:
> On Mon, Oct 29, 2012 at 08:40:44AM +0800, Fengguang Wu wrote:
> > Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR
> > 
> > Generated by: coccinelle/api/ptr_ret.cocci
> 
> Applied, thanks.
> 
> I have collapsed this patch and the one for ipv6/iptable_nat.c. They
> are pretty small and description is the same.

That would be good, thanks!

Thanks,
Fengguang
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- linux-next.orig/net/ipv4/netfilter/iptable_nat.c	2012-10-23 09:44:52.577430992 +0800
+++ linux-next/net/ipv4/netfilter/iptable_nat.c	2012-10-29 08:38:43.063222201 +0800
@@ -274,9 +274,7 @@  static int __net_init iptable_nat_net_in
 		return -ENOMEM;
 	net->ipv4.nat_table = ipt_register_table(net, &nf_nat_ipv4_table, repl);
 	kfree(repl);
-	if (IS_ERR(net->ipv4.nat_table))
-		return PTR_ERR(net->ipv4.nat_table);
-	return 0;
+	return PTR_RET(net->ipv4.nat_table);
 }
 
 static void __net_exit iptable_nat_net_exit(struct net *net)