Re: Result of compiling with `-W'

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Thu Jul 13 2000 - 11:20:52 EST


> outw(DownStall, ioaddr + EL3_CMD);
> /* Wait for the stall to complete. */
> + /* BUG! `i' is unsigned */
> for (i = 20; i >= 0; i--)
> if ((inw(ioaddr + EL3_STATUS) & CmdInProgress) ==
> 0) break;

I should be signed

> case AX25_T3:
> - if (ax25_ctl.arg < 0)
> + if ((signed long)ax25_ctl.arg < 0)
> - if (ax25_ctl.arg < 0)
> + if ((signed long)ax25_ctl.arg < 0)
> return -EINVAL;

Partial but incomplete fix. I think it also should be checking if
60*HZ*value is an overflow..

> case TIOCOUTQ:
> amount = sk->sndbuf - atomic_read(&sk->wmem_alloc);
> - if (amount < 0)
> + if ((signed long)amount < 0)
> amount = 0;
> err = put_user(amount, (int *)arg);
> break;

Cleaner is

        {
                signed long room = sk->sndbuf - atom..

                ...
        }

> board.port = (unsigned char *)ints[index];
> - if (board.port <= 0)
> + if ((long)board.port <= 0)

Should just be board.port == 0 ??

> /* Register devices */
> - if ((card->audio1_num = register_sound_dsp(&emu10k1_audio_fops, -1)) < 0) {
> + if ((signed long)(card->audio1_num = register_sound_dsp(&emu10k1_audio_fops, -1)) < 0) {

Fix the type of card->foo_num to be signed instead - the fix is right.

> --- linux-2.4.0-test4-pre6/ipc/shm.c Tue Jul 11 22:21:17 2000
> +++ linux-akpm/ipc/shm.c Thu Jul 13 22:44:52 2000
> @@ -796,7 +796,7 @@
> struct shmid_kernel *shp;
> int err, id = 0;
>
> - if (size < SHMMIN)
> + if ((signed long)size < SHMMIN)
> return -EINVAL;

No. You can allocate over 2Gigs in a shared memory segment, and there are
a few people who actually configure and do this with some hacks in 2.2, let
alone 2.4.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jul 15 2000 - 21:00:17 EST