netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [IPv6]: Invalid semicolon after if statement
@ 2007-08-15 21:57 Ilpo Järvinen
  2007-08-15 22:08 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Ilpo Järvinen @ 2007-08-15 21:57 UTC (permalink / raw)
  To: David Miller, YOSHIFUJI Hideaki; +Cc: Netdev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 852 bytes --]


A similar fix to netfilter from Eric Dumazet inspired me to
look around a bit by using some grep/sed stuff as looking for
this kind of bugs seemed easy to automate. This is one of them
I found where it looks like this semicolon is not valid.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 net/ipv6/ipv6_sockglue.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index d684639..761a910 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -820,7 +820,7 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
 		return 0;
 
 	len = min_t(unsigned int, len, ipv6_optlen(hdr));
-	if (copy_to_user(optval, hdr, len));
+	if (copy_to_user(optval, hdr, len))
 		return -EFAULT;
 	return ipv6_optlen(hdr);
 }
-- 
1.5.0.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] [IPv6]: Invalid semicolon after if statement
  2007-08-15 21:57 [PATCH] [IPv6]: Invalid semicolon after if statement Ilpo Järvinen
@ 2007-08-15 22:08 ` David Miller
  2007-08-15 23:52   ` Dave Jones
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2007-08-15 22:08 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: yoshfuji, netdev

From: "Ilpo_Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Thu, 16 Aug 2007 00:57:00 +0300 (EEST)

> A similar fix to netfilter from Eric Dumazet inspired me to
> look around a bit by using some grep/sed stuff as looking for
> this kind of bugs seemed easy to automate. This is one of them
> I found where it looks like this semicolon is not valid.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>

Yikes!  Makes you want to audit the entire tree for these
things :-)))

Patch applied, thanks a lot Ilpo!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [IPv6]: Invalid semicolon after if statement
  2007-08-15 22:08 ` David Miller
@ 2007-08-15 23:52   ` Dave Jones
  2007-08-16  0:51     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Dave Jones @ 2007-08-15 23:52 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Wed, Aug 15, 2007 at 03:08:14PM -0700, David Miller wrote:
 > From: "Ilpo_Järvinen" <ilpo.jarvinen@helsinki.fi>
 > Date: Thu, 16 Aug 2007 00:57:00 +0300 (EEST)
 > 
 > > A similar fix to netfilter from Eric Dumazet inspired me to
 > > look around a bit by using some grep/sed stuff as looking for
 > > this kind of bugs seemed easy to automate. This is one of them
 > > I found where it looks like this semicolon is not valid.
 > > 
 > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
 > 
 > Yikes!  Makes you want to audit the entire tree for these
 > things :-)))
 
Indeed.  Here's another one.


Signed-off-by: Dave Jones <davej@redhat.com>

diff --git a/net/netfilter/xt_u32.c b/net/netfilter/xt_u32.c
index 74f9b14..bec4279 100644
--- a/net/netfilter/xt_u32.c
+++ b/net/netfilter/xt_u32.c
@@ -36,7 +36,7 @@ static bool u32_match_it(const struct xt_u32 *data,
 		at  = 0;
 		pos = ct->location[0].number;
 
-		if (skb->len < 4 || pos > skb->len - 4);
+		if (skb->len < 4 || pos > skb->len - 4)
 			return false;
 
 		ret   = skb_copy_bits(skb, pos, &n, sizeof(n));


-- 
http://www.codemonkey.org.uk

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] [IPv6]: Invalid semicolon after if statement
  2007-08-15 23:52   ` Dave Jones
@ 2007-08-16  0:51     ` David Miller
  2007-08-16  9:25       ` Ilpo Järvinen
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2007-08-16  0:51 UTC (permalink / raw)
  To: davej; +Cc: netdev

From: Dave Jones <davej@redhat.com>
Date: Wed, 15 Aug 2007 19:52:20 -0400

> On Wed, Aug 15, 2007 at 03:08:14PM -0700, David Miller wrote:
>  > From: "Ilpo_Järvinen" <ilpo.jarvinen@helsinki.fi>
>  > Date: Thu, 16 Aug 2007 00:57:00 +0300 (EEST)
>  > 
>  > > A similar fix to netfilter from Eric Dumazet inspired me to
>  > > look around a bit by using some grep/sed stuff as looking for
>  > > this kind of bugs seemed easy to automate. This is one of them
>  > > I found where it looks like this semicolon is not valid.
>  > > 
>  > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
>  > 
>  > Yikes!  Makes you want to audit the entire tree for these
>  > things :-)))
>  
> Indeed.  Here's another one.
> 
> Signed-off-by: Dave Jones <davej@redhat.com>

That got fixed the other day and is the "A similar fix to netfilter
from Eric Dumazet" Ilpo is reffering to above :)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] [IPv6]: Invalid semicolon after if statement
  2007-08-16  0:51     ` David Miller
@ 2007-08-16  9:25       ` Ilpo Järvinen
  0 siblings, 0 replies; 5+ messages in thread
From: Ilpo Järvinen @ 2007-08-16  9:25 UTC (permalink / raw)
  To: David Miller; +Cc: davej, Netdev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1996 bytes --]

On Wed, 15 Aug 2007, David Miller wrote:

> From: Dave Jones <davej@redhat.com>
> Date: Wed, 15 Aug 2007 19:52:20 -0400
> 
> > On Wed, Aug 15, 2007 at 03:08:14PM -0700, David Miller wrote:
> >  > From: "Ilpo_Järvinen" <ilpo.jarvinen@helsinki.fi>
> >  > Date: Thu, 16 Aug 2007 00:57:00 +0300 (EEST)
> >  > 
> >  > > A similar fix to netfilter from Eric Dumazet inspired me to
> >  > > look around a bit by using some grep/sed stuff as looking for
> >  > > this kind of bugs seemed easy to automate. This is one of them
> >  > > I found where it looks like this semicolon is not valid.
> >  > > 
> >  > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> >  > 
> >  > Yikes!  Makes you want to audit the entire tree for these
> >  > things :-)))
> >  
> > Indeed.  Here's another one.
> > 
> > Signed-off-by: Dave Jones <davej@redhat.com>
> 
> That got fixed the other day and is the "A similar fix to netfilter
> from Eric Dumazet" Ilpo is reffering to above :)

...heh, when I said "a bit", I meant that it took a very little effort
to check over the whole tree... :-)

...I've already reported all four things one could find from whole tree 
with this cmd (to the relevant parties), so no need for you to redo the 
effort :-) :

$ for i in `find . -name '*.[ch]'`; do echo $i;
	sed -n -e '/^\t*if *[(].*[)] *; *$/ N'
		-e '/^\(\t*\)if *[(].*[)] *; *\n\1\t/ p' $i; done | tee result

...Basically it checks if the next line has more indentation than the
if line. ...Obviously it will work only if the code follows current 
CodingStyle in indentation. I'm currently experimenting with indent 
preprocessing step... ...but I'm not yet sure if I can pull something 
useful out from that too :-)

...Better cmdlines could be invented, e.g. by manually checking every "if 
();" lines once one has first automated separation of them from "if () 
do_smthg();" lines (I haven't learned myself how to easily count/work with 
parenthesis pairs in a cmdline, which seems necessary here)...

-- 
 i.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-08-16  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-15 21:57 [PATCH] [IPv6]: Invalid semicolon after if statement Ilpo Järvinen
2007-08-15 22:08 ` David Miller
2007-08-15 23:52   ` Dave Jones
2007-08-16  0:51     ` David Miller
2007-08-16  9:25       ` Ilpo Järvinen

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).