mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2.4.26] drivers/char/vt.c fix compiler warnings
@ 2004-05-15 13:05 Thomas Gleixner
  2004-05-17 10:47 ` Andries Brouwer
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2004-05-15 13:05 UTC (permalink / raw)
  To: linux-kernel


The patch fixes the following warnings, produced by gcc3.3.3:

vt.c: In function `do_kdsk_ioctl':
vt.c:166: warning: comparison is always false due to limited range of data 
type
vt.c: In function `do_kdgkb_ioctl':
vt.c:283: warning: comparison is always false due to limited range of data 
type

s is a unsigned char, which can never be >= MAX_NR_KEYMAPS, as MAX_NR_KEYMAPS 
= 256

tmp.kb_func is an unsigned char, which can never be > MAX_NR_FUNC, which is = 
256

Maybe it is neccecary to change the types from unsigned char to uint8_t ?

-- 
Thomas
________________________________________________________________________
"Free software" is a matter of liberty, not price. To understand the concept,
you should think of "free" as in "free speech,'' not as in "free beer".
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@linutronix.de

--- linux-2.4.26.org/drivers/char/vt.c	2002-11-29 00:53:12.000000000 +0100
+++ linux-2.4.26/drivers/char/vt.c	2004-05-15 15:02:05.000000000 +0200
@@ -163,7 +163,7 @@
 
 	if (copy_from_user(&tmp, user_kbe, sizeof(struct kbentry)))
 		return -EFAULT;
-	if (i >= NR_KEYS || s >= MAX_NR_KEYMAPS)
+	if (i >= NR_KEYS)
 		return -EINVAL;	
 
 	switch (cmd) {
@@ -280,8 +280,6 @@
 	if (copy_from_user(&tmp, user_kdgkb, sizeof(struct kbsentry)))
 		return -EFAULT;
 	tmp.kb_string[sizeof(tmp.kb_string)-1] = '\0';
-	if (tmp.kb_func >= MAX_NR_FUNC)
-		return -EINVAL;
 	i = tmp.kb_func;
 
 	switch (cmd) {


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-05-17 15:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-15 13:05 [PATCH 2.4.26] drivers/char/vt.c fix compiler warnings Thomas Gleixner
2004-05-17 10:47 ` Andries Brouwer
2004-05-17 12:47   ` Thomas Gleixner
2004-05-17 13:36     ` Andries Brouwer
2004-05-17 15:40     ` Valdis.Kletnieks

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®