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

From: Andries Brouwer
Date: Mon May 17 2004 - 08:36:58 EST


On Mon, May 17, 2004 at 02:47:56PM +0200, Thomas Gleixner wrote:

> > (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.)
>
> Ooops, did not think about that. Was just annoyed from the compiler warnings.
> What about:
>
> if (copy_from_user(&tmp, user_kbe, sizeof(struct kbentry)))
> return -EFAULT;
> +#if MAX_NR_KEYMAPS < 256
> if (i >= NR_KEYS || s >= MAX_NR_KEYMAPS)
> +#else
> + if (i >= NR_KEYS)
> +#endif

(i) My muttering was not just about this case - also elsewhere
you removed tests that are only superfluous under a particular
constellation of #define-s.
(ii) Introducing conditional compilation certainly would not
make anybody happier.

I don't have the code nearby, but probably you could use an (unsigned) integer
variable.

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/