* [PATCH] net: netfilter/xt_CT.c: fix uninitialized variable
@ 2013-01-15 18:58 Cong Ding
2013-01-15 19:06 ` Waskiewicz Jr, Peter P
2013-01-15 19:18 ` Pablo Neira Ayuso
0 siblings, 2 replies; 4+ messages in thread
From: Cong Ding @ 2013-01-15 18:58 UTC (permalink / raw)
To: Pablo Neira Ayuso, Patrick McHardy, David S. Miller,
netfilter-devel, netfilter, coreteam, netdev, linux-kernel
Cc: Cong Ding
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
ret = nf_ct_l3proto_try_module_get(par->family);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: netfilter/xt_CT.c: fix uninitialized variable
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
2013-01-15 19:16 ` Cong Ding
2013-01-15 19:18 ` Pablo Neira Ayuso
1 sibling, 1 reply; 4+ messages in thread
From: Waskiewicz Jr, Peter P @ 2013-01-15 19:06 UTC (permalink / raw)
To: Cong Ding
Cc: Pablo Neira Ayuso, Patrick McHardy, David S. Miller,
netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org,
coreteam@netfilter.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: netfilter/xt_CT.c: fix uninitialized variable
2013-01-15 19:06 ` Waskiewicz Jr, Peter P
@ 2013-01-15 19:16 ` Cong Ding
0 siblings, 0 replies; 4+ messages in thread
From: Cong Ding @ 2013-01-15 19:16 UTC (permalink / raw)
To: Waskiewicz Jr, Peter P
Cc: Pablo Neira Ayuso, Patrick McHardy, David S. Miller,
netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org,
coreteam@netfilter.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
On Tue, Jan 15, 2013 at 07:06:51PM +0000, Waskiewicz Jr, Peter P wrote:
> 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.
The label err1 are also used in line 130 and 298. I change it to "return
-EINVAL" rather than initialize ret to -EINVAL is to keep it the same as line
115 and 253. Otherwise, we should change line 115 and 253 to be goto err1,
too?
- cong
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: netfilter/xt_CT.c: fix uninitialized variable
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
@ 2013-01-15 19:18 ` Pablo Neira Ayuso
1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2013-01-15 19:18 UTC (permalink / raw)
To: Cong Ding
Cc: Patrick McHardy, David S. Miller, netfilter-devel, netfilter,
coreteam, netdev, linux-kernel
Hi Cong,
On Tue, Jan 15, 2013 at 07:58:34PM +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.
This is already fixed in the net tree.
http://git.kernel.org/?p=linux/kernel/git/davem/net.git;a=commit;h=4610476d89d53714ca94aae081fa035908bc137a
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-15 19:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-01-15 19:16 ` Cong Ding
2013-01-15 19:18 ` Pablo Neira Ayuso
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).