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

From: Valdis . Kletnieks
Date: Mon May 17 2004 - 10:43:27 EST


On Mon, 17 May 2004 14:47:56 +0200, Thomas Gleixner said:

> Ooops, did not think about that. Was just annoyed from the compiler warnings.
> What about:

> +#if MAX_NR_KEYMAPS < 256
> if (i >= NR_KEYS || s >= MAX_NR_KEYMAPS)
> +#else
> + if (i >= NR_KEYS)
> +#endif
> return -EINVAL;

Speaking as somebody who's had stuff rejected for doing this sort of ifdef'ing,
the *right* fix is to go back and look at the definitions of everything, and
see if there's a reason why the compiler is tossing the warning.

Canonical example is, of course the userland:

char c;
if ((c=getc()) != EOF) {....

(I don't have a 2.4 tree handy to double-check, but maybe the variable 's'
should be something wider? It's *quite* possible that there is/will be some
keyboard of the Chinese/Japanese/Korean persuasion which actually ends up with
more than 256 keymap entries.....



Attachment: pgp00000.pgp
Description: PGP signature