netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Waskiewicz Jr, Peter P" <peter.p.waskiewicz.jr@intel.com>
To: Cong Ding <dinggnu@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	Patrick McHardy <kaber@trash.net>,
	"David S. Miller" <davem@davemloft.net>,
	"netfilter-devel@vger.kernel.org"
	<netfilter-devel@vger.kernel.org>,
	"netfilter@vger.kernel.org" <netfilter@vger.kernel.org>,
	"coreteam@netfilter.org" <coreteam@netfilter.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: netfilter/xt_CT.c: fix uninitialized variable
Date: Tue, 15 Jan 2013 19:06:51 +0000	[thread overview]
Message-ID: <1358276792.1991.121.camel@ppwaskie-mobl2> (raw)
In-Reply-To: <1358276314-9536-1-git-send-email-dinggnu@gmail.com>

On Tue, 2013-01-15 at 19:58 +0100, Cong Ding wrote:
> If CONFIG_NF_CONNTRACK_ZONES is not defined, the variable ret might be
> uninitialized when it goes to err1 through line 125 and 263 respectively.
> So I change these goto err1 to return -EINVAL directly.
> 
> Signed-off-by: Cong Ding <dinggnu@gmail.com>
> ---
>  net/netfilter/xt_CT.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c
> index 2a08430..941f600 100644
> --- a/net/netfilter/xt_CT.c
> +++ b/net/netfilter/xt_CT.c
> @@ -122,7 +122,7 @@ static int xt_ct_tg_check_v0(const struct xt_tgchk_param *par)
>  
>  #ifndef CONFIG_NF_CONNTRACK_ZONES
>  	if (info->zone)
> -		goto err1;
> +		return -EINVAL;
>  #endif
>  
>  	ret = nf_ct_l3proto_try_module_get(par->family);
> @@ -260,7 +260,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par)
>  
>  #ifndef CONFIG_NF_CONNTRACK_ZONES
>  	if (info->zone)
> -		goto err1;
> +		return -EINVAL;
>  #endif

In dropping both goto's, you left the err1 label unused.  Wouldn't just
initializing ret to -EINVAL be easier and cleaner?  Then you wouldn't be
messing with the flow of the function.

-PJ

  reply	other threads:[~2013-01-15 19:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 18:58 [PATCH] net: netfilter/xt_CT.c: fix uninitialized variable Cong Ding
2013-01-15 19:06 ` Waskiewicz Jr, Peter P [this message]
2013-01-15 19:16   ` Cong Ding
2013-01-15 19:18 ` 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=1358276792.1991.121.camel@ppwaskie-mobl2 \
    --to=peter.p.waskiewicz.jr@intel.com \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=dinggnu@gmail.com \
    --cc=kaber@trash.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=netfilter@vger.kernel.org \
    --cc=pablo@netfilter.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).