Re: [PATCH] i386, nmi: signed vs unsigned mixup

From: Jesper Juhl
Date: Mon Nov 21 2005 - 05:45:52 EST


On 11/20/05, Jesper Juhl <jesper.juhl@xxxxxxxxx> wrote:
> On 11/20/05, Andrew Morton <akpm@xxxxxxxx> wrote:
[snip]
> >
> > Sure, go for it - let's see what the patches end up looking like. We might
> > find real bugs in there - I found a bunch of howlers back in 2.3.late.
> > That was with `gcc -W' which turns on more than -Wsigned-compare.
> >
> > Maybe you could prepare a quick overall summary first, see if you can work
> > out the overall scope of the problem and then we can take a look at that,
> > decide what bits to attack?
> >
> Sure, I'll do that tomorrow.
> All these sign issues all over annoy me :)
> I'll try to get a handle on the scope of the thing tomorrow, then send
> a mail with what I find, then we can talk about what would be useful
> to do.
>

Ok, I did an allyesconfig build (x86 build) of 2.6.15-rc2 with
-Wsign-compare and I have some numbers.

The total number of warnings for the build ended up at 14681
Of course some of the warnings are not related to sign issues, so
let's look at just

comparison between signed and unsigned (12378 instances of this one)
signed and unsigned type in conditional expression (2109 instances
of this one)
comparison of promoted ~unsigned with constant (4 instances of this one)

So for the signedness related warnings we have a total of 14491 warnings.
The 14491 warnings come from a total of 1701 files.

This looks like a lot, but it's really not as bad as it looks since a
lot of the warnings are duplicates.

Let's take a look at the top 10 offenders :

1)
4078 counts of
warning: comparison between signed and unsigned
from include/asm/bitops.h:339

2)
1125 counts of
warning: comparison between signed and unsigned
from include/linux/netdevice.h:796

3)
256 counts of
warning: signed and unsigned type in conditional expression
from drivers/scsi/aic7xxx/aic79xx_osm_pci.c:79

4)
256 counts of
warning: signed and unsigned type in conditional expression
from drivers/scsi/aic7xxx/aic79xx_osm_pci.c:77

5)
120 counts of
warning: signed and unsigned type in conditional expression
from fs/xfs/xfs_mount.h:458

6)
90 counts of
warning: comparison between signed and unsigned
from include/net/tcp_ecn.h:53

7)
90 counts of
warning: comparison between signed and unsigned
from include/net/tcp.h:866

8)
90 counts of
warning: signed and unsigned type in conditional expression
from include/net/tcp.h:1148

9)
90 counts of
warning: signed and unsigned type in conditional expression
from include/net/tcp.h:1143

10)
86 counts of
warning: comparison between signed and unsigned
from include/linux/fb.h:859


So, if we just cleaned up the top 10 offenders we'd get rid of 6281
out of the total 14491 warnings.

I've not yet looked at what would be involved in fixing these top 10,
I'll look at that later, for now I just wanted to post the numbers I
had.


--
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/