From: Simon Horman <horms@verge.net.au>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Wensong Zhang <wensong@linux-vs.org>,
kernel-janitors@vger.kernel.org, Julian Anastasov <ja@ssi.bg>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Patrick McHardy <kaber@trash.net>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, lvs-devel@vger.kernel.org,
netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org,
coreteam@netfilter.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/7] ipvs: fix error return code
Date: Thu, 30 Aug 2012 10:12:15 +0900 [thread overview]
Message-ID: <20120830011215.GL4127@verge.net.au> (raw)
In-Reply-To: <1346258957-7649-2-git-send-email-Julia.Lawall@lip6.fr>
On Wed, Aug 29, 2012 at 06:49:11PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Initialize return variable before exiting on an error path.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> (
> if@p1 (\(ret < 0\|ret != 0\))
> { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
> when != &ret
> *if(...)
> {
> ... when != ret = e2
> when forall
> return ret;
> }
>
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> net/netfilter/ipvs/ip_vs_ctl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> index 3c60137..767cc12 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> @@ -1171,8 +1171,10 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
> goto out_err;
> }
> svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
> - if (!svc->stats.cpustats)
> + if (!svc->stats.cpustats) {
> + ret = -ENOMEM;
> goto out_err;
> + }
>
> /* I'm the first user of the service */
> atomic_set(&svc->usecnt, 0);
Acked-by: Simon Horman <horms@verge.net.au>
next prev parent reply other threads:[~2012-08-30 1:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1346258957-7649-1-git-send-email-Julia.Lawall@lip6.fr>
2012-08-29 16:49 ` [PATCH 1/7] ipvs: fix error return code Julia Lawall
2012-08-30 1:12 ` Simon Horman [this message]
2012-08-30 1:34 ` Pablo Neira Ayuso
2012-08-29 16:49 ` [PATCH 7/7] net/netfilter/nf_conntrack_netlink.c: " Julia Lawall
2012-08-30 1:35 ` Pablo Neira Ayuso
2012-08-29 16:49 ` [PATCH 6/7] net/netfilter/nfnetlink_log.c: " Julia Lawall
2012-08-30 1:35 ` Pablo Neira Ayuso
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=20120830011215.GL4127@verge.net.au \
--to=horms@verge.net.au \
--cc=Julia.Lawall@lip6.fr \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=ja@ssi.bg \
--cc=kaber@trash.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvs-devel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=netfilter@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=wensong@linux-vs.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;
as well as URLs for NNTP newsgroup(s).