Re: [PATCH 2.4.26] drivers/char/vt.c fix compiler warnings

From: Andries Brouwer
Date: Mon May 17 2004 - 05:48:47 EST


4~On Sat, May 15, 2004 at 03:05:23PM +0200, Thomas Gleixner wrote:

> The patch fixes the following warnings, produced by gcc3.3.3:
>
> s is a unsigned char, which can never be >= MAX_NR_KEYMAPS, as MAX_NR_KEYMAPS
> = 256

> - if (i >= NR_KEYS || s >= MAX_NR_KEYMAPS)
> + if (i >= NR_KEYS)
> return -EINVAL;

You see that you break thew source in order to avoid a compiler warning. Bad.

(MAX_NR_KEYMAPS is a #define, often 256, on tiny systems people tend to pick 16.
The above test is not superfluous. MAX_NR_KEYMAPS is not an absolute constant.)

Andries
-
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/