From: tglx@linutronix.de (Thomas Gleixner)
To: Andries Brouwer <aebr@win.tue.nl>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.4.26] drivers/char/vt.c fix compiler warnings
Date: Mon, 17 May 2004 14:47:56 +0200 [thread overview]
Message-ID: <200405171447.56737.tglx@linutronix.de> (raw)
In-Reply-To: <20040517104729.GA8933@wsdw14.win.tue.nl>
On Monday 17 May 2004 12:47, Andries Brouwer wrote:
> 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.)
Ooops, did not think about that. Was just annoyed from the compiler warnings.
What about:
--- linux-2.4.26-preempt/drivers/char/vt.c 2002-11-29 00:53:12.000000000 +0100
+++ linux-2.4.26-rc2-work/drivers/char/vt.c 2004-05-17 14:44:27.000000000
+0200
@@ -163,7 +163,11 @@
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
return -EINVAL;
switch (cmd) {
--
Thomas
________________________________________________________________________
Steve Ballmer quotes the statistic that IT pros spend 70 percent of their
time managing existing systems. That couldn’t have anything to do with
the fact that 99 percent of these systems run Windows, could it?
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de
next prev parent reply other threads:[~2004-05-17 12:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-15 13:05 Thomas Gleixner
2004-05-17 10:47 ` Andries Brouwer
2004-05-17 12:47 ` Thomas Gleixner [this message]
2004-05-17 13:36 ` Andries Brouwer
2004-05-17 15:40 ` Valdis.Kletnieks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200405171447.56737.tglx@linutronix.de \
--to=tglx@linutronix.de \
--cc=aebr@win.tue.nl \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®