public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers/char/keyboard.c unsigned comparison
@ 2005-11-12 20:25 Gabriel A. Devenyi
  0 siblings, 0 replies; only message in thread
From: Gabriel A. Devenyi @ 2005-11-12 20:25 UTC (permalink / raw)
  To: linux-kernel

keycode is a checked for a value less than zero, but is defined as an unsigned int, and is only called in one place in the kernel, and passed a unsigned int, so this comparison is bogus.

Thanks to LinuxICC (http://linuxicc.sf.net)

This patch applies to Linus' git tree as of 12.11.2005

Signed-off-by: Gabriel A. Devenyi

diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 449d029..6e991ea 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -198,7 +198,7 @@ int setkeycode(unsigned int scancode, un
 
 	if (scancode >= dev->keycodemax)
 		return -EINVAL;
-	if (keycode < 0 || keycode > KEY_MAX)
+	if (keycode > KEY_MAX)
 		return -EINVAL;
 	if (dev->keycodesize < sizeof(keycode) && (keycode >> (dev->keycodesize * 8)))
 		return -EINVAL;

-- 
Gabriel A. Devenyi
ace@staticwave.ca

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2005-11-12 20:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-12 20:25 [PATCH] drivers/char/keyboard.c unsigned comparison Gabriel A. Devenyi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox