[PATCH] Re: bugs in /usr/src/linux/net/ipv6/mcast.c

From: Denis Vlasenko
Date: Thu Nov 17 2005 - 08:00:34 EST


[CC: added to respective maintainers]

On Thursday 17 November 2005 00:24, Cipriani, Lawrence V (Larry) wrote:
>
> Thanks. We're on 2.4.x For what it's worth, here are a few more I found:

As far as I can see, none of these exist in 2.6.

(BTW, how did you find them? That one with multi line 'while'
is hard to find with grep)

However, a few similar bugs do exist in 2.6!

Patch attached.

Patch intentionally places a comment instead of statement
in few false positives.

Please review/apply.
--
vda
diff -urpN linux-2.6.14.org/drivers/isdn/capi/capiutil.c linux-2.6.14.semicolon_fix/drivers/isdn/capi/capiutil.c
--- linux-2.6.14.org/drivers/isdn/capi/capiutil.c Mon Aug 29 02:41:01 2005
+++ linux-2.6.14.semicolon_fix/drivers/isdn/capi/capiutil.c Thu Nov 17 14:41:58 2005
@@ -404,7 +404,8 @@ static unsigned command_2_index(unsigned
{
if (c & 0x80)
c = 0x9 + (c & 0x0f);
- else if (c <= 0x0f);
+ else if (c <= 0x0f)
+ /* do nothing */;
else if (c == 0x41)
c = 0x9 + 0x1;
else if (c == 0xff)
diff -urpN linux-2.6.14.org/drivers/media/dvb/frontends/ves1820.c linux-2.6.14.semicolon_fix/drivers/media/dvb/frontends/ves1820.c
--- linux-2.6.14.org/drivers/media/dvb/frontends/ves1820.c Sat Nov 5 15:17:30 2005
+++ linux-2.6.14.semicolon_fix/drivers/media/dvb/frontends/ves1820.c Thu Nov 17 14:41:05 2005
@@ -140,25 +140,25 @@ static int ves1820_set_symbolrate(struct
/* yeuch! */
fpxin = state->config->xin * 10;
fptmp = fpxin; do_div(fptmp, 123);
- if (symbolrate < fptmp);
+ if (symbolrate < fptmp)
SFIL = 1;
fptmp = fpxin; do_div(fptmp, 160);
- if (symbolrate < fptmp);
+ if (symbolrate < fptmp)
SFIL = 0;
fptmp = fpxin; do_div(fptmp, 246);
- if (symbolrate < fptmp);
+ if (symbolrate < fptmp)
SFIL = 1;
fptmp = fpxin; do_div(fptmp, 320);
- if (symbolrate < fptmp);
+ if (symbolrate < fptmp)
SFIL = 0;
fptmp = fpxin; do_div(fptmp, 492);
- if (symbolrate < fptmp);
+ if (symbolrate < fptmp)
SFIL = 1;
fptmp = fpxin; do_div(fptmp, 640);
- if (symbolrate < fptmp);
+ if (symbolrate < fptmp)
SFIL = 0;
fptmp = fpxin; do_div(fptmp, 984);
- if (symbolrate < fptmp);
+ if (symbolrate < fptmp)
SFIL = 1;

fin = state->config->xin >> 4;
diff -urpN linux-2.6.14.org/drivers/net/tokenring/ibmtr.c linux-2.6.14.semicolon_fix/drivers/net/tokenring/ibmtr.c
--- linux-2.6.14.org/drivers/net/tokenring/ibmtr.c Sat Nov 5 15:17:37 2005
+++ linux-2.6.14.semicolon_fix/drivers/net/tokenring/ibmtr.c Thu Nov 17 14:42:56 2005
@@ -610,8 +610,10 @@ static int __devinit ibmtr_probe1(struct
ti->mapped_ram_size= /*sixteen to onehundredtwentyeight 512byte blocks*/
1<< ((readb(ti->mmio+ACA_OFFSET+ACA_RW+RRR_ODD) >> 2 & 0x03) + 4);
ti->page_mask = 0;
- if (ti->turbo) ti->page_mask=0xf0;
- else if (ti->shared_ram_paging == 0xf); /* No paging in adapter */
+ if (ti->turbo)
+ ti->page_mask=0xf0;
+ else if (ti->shared_ram_paging == 0xf)
+ /* No paging in adapter */;
else {
#ifdef ENABLE_PAGING
unsigned char pg_size = 0;
diff -urpN linux-2.6.14.org/net/netrom/nr_in.c linux-2.6.14.semicolon_fix/net/netrom/nr_in.c
--- linux-2.6.14.org/net/netrom/nr_in.c Sat Nov 5 15:18:17 2005
+++ linux-2.6.14.semicolon_fix/net/netrom/nr_in.c Thu Nov 17 14:43:53 2005
@@ -99,7 +99,7 @@ static int nr_state1_machine(struct sock
break;

case NR_RESET:
- if (sysctl_netrom_reset_circuit);
+ if (sysctl_netrom_reset_circuit)
nr_disconnect(sk, ECONNRESET);
break;

@@ -130,7 +130,7 @@ static int nr_state2_machine(struct sock
break;

case NR_RESET:
- if (sysctl_netrom_reset_circuit);
+ if (sysctl_netrom_reset_circuit)
nr_disconnect(sk, ECONNRESET);
break;

@@ -265,7 +265,7 @@ static int nr_state3_machine(struct sock
break;

case NR_RESET:
- if (sysctl_netrom_reset_circuit);
+ if (sysctl_netrom_reset_circuit)
nr_disconnect(sk, ECONNRESET);
break;