Skip to contentSkip to conversation

wistron_btns: Fix missing BIOS signature handling

PATCH In review Miloslav Trmac 2 participants 4 messages Jan 8, 2006

Subsystems (2)
lore
Share & tools
lore

Miloslav Trmac

author maintainer
#0 lore raw

PATCH 1/1 wistron_btns: Fix missing BIOS signature handling

offset can never be < 0 because it has type size_t. The driver currently oopses on insmod if BIOS does not support the interface, instead of refusing to load.

offset can never be < 0 because it has type size_t. The driver currently oopses on insmod if BIOS does not support the interface, instead of refusing to load.

drivers/input/misc/wistron_btns.c +1 -1
diff -r 88ae680122c0 wistron_btns.c
@@ -114,7 +114,7 @@
 
 	base = ioremap(0xF0000, 0x10000); /* Can't fail */
 	offset = locate_wistron_bios(base);
-	if (offset < 0) {
+	if (offset == (size_t)-1) {
 		printk(KERN_ERR "wistron_btns: BIOS entry point not found\n");
 		iounmap(base);
 		return -ENODEV;
#1 lore raw
Quoted 4 lines · Miloslav Trmac

offset can never be < 0 because it has type size_t. The driver currently oopses on insmod if BIOS does not support the interface, instead of refusing to load.

I don't really like that casting, should we just change offset to ssize_t?

Signature · 1 line
Dmitry
author maintainer
#2 lore raw

PATCH 1/1 wistron_btns: Fix missing BIOS signature handling, take 2

Quoted 7 lines · Dmitry Torokhov
Quoted 3 lines · Miloslav Trmac

offset can never be < 0 because it has type size_t. The driver currently oopses on insmod if BIOS does not support the interface, instead of refusing to load.

I don't really like that casting, should we just change offset to ssize_t?

Sure.
Mirek

offset can never be < 0 because it has type size_t. The driver currently oopses on insmod if BIOS does not support the interface, instead of refusing to load.

drivers/input/misc/wistron_btns.c +3 -3
@@ -92,11 +92,11 @@
 	preempt_enable();
 }
 
-static size_t __init locate_wistron_bios(void __iomem *base)
+static ssize_t __init locate_wistron_bios(void __iomem *base)
 {
 	static const unsigned char __initdata signature[] =
 		{ 0x42, 0x21, 0x55, 0x30 };
-	size_t offset;
+	ssize_t offset;
 
 	for (offset = 0; offset < 0x10000; offset += 0x10) {
 		if (check_signature(base + offset, signature,
@@ -109,7 +109,7 @@
 static int __init map_bios(void)
 {
 	void __iomem *base;
-	size_t offset;
+	ssize_t offset;
 	u32 entry_point;
 
 	base = ioremap(0xF0000, 0x10000); /* Can't fail */
#3 lore raw

Re: [PATCH] wistron_btns: Fix missing BIOS signature handling, take 2

Quoted 11 lines · Miloslav Trmac
Quoted 7 lines · Dmitry Torokhov
Quoted 3 lines · Miloslav Trmac

offset can never be < 0 because it has type size_t. The driver currently oopses on insmod if BIOS does not support the interface, instead of refusing to load.

I don't really like that casting, should we just change offset to ssize_t?

Sure.
Mirek

Thank you, I will add this to input tree.

Signature · 1 line
Dmitry