linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wistron_btns: Fix missing BIOS signature handling
@ 2006-01-08  6:39 Miloslav Trmac
  2006-01-08  6:58 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Miloslav Trmac @ 2006-01-08  6:39 UTC (permalink / raw)
  To: Dmitry Torokhov, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 160 bytes --]

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.

[-- Attachment #2: wistron-no-entry.patch --]
[-- Type: text/x-patch, Size: 640 bytes --]

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.

Signed-off-by: Miloslav Trmac <mitr@volny.cz>

diff -r 88ae680122c0 wistron_btns.c
--- a/drivers/input/misc/wistron_btns.c	Sun Dec 11 21:18:28 2005
+++ b/drivers/input/misc/wistron_btns.c	Sun Jan  8 07:24:44 2006
@@ -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;

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

* Re: [PATCH] wistron_btns: Fix missing BIOS signature handling
  2006-01-08  6:39 [PATCH] wistron_btns: Fix missing BIOS signature handling Miloslav Trmac
@ 2006-01-08  6:58 ` Dmitry Torokhov
  2006-01-08  7:52   ` [PATCH] wistron_btns: Fix missing BIOS signature handling, take 2 Miloslav Trmac
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2006-01-08  6:58 UTC (permalink / raw)
  To: Miloslav Trmac; +Cc: Linux Kernel Mailing List

On Sunday 08 January 2006 01:39, Miloslav Trmac wrote:
> 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?

-- 
Dmitry

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

* [PATCH] wistron_btns: Fix missing BIOS signature handling, take 2
  2006-01-08  6:58 ` Dmitry Torokhov
@ 2006-01-08  7:52   ` Miloslav Trmac
  2006-01-08 16:13     ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Miloslav Trmac @ 2006-01-08  7:52 UTC (permalink / raw)
  To: Dmitry Torokhov, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]

Dmitry Torokhov wrote:
> On Sunday 08 January 2006 01:39, Miloslav Trmac wrote:
> 
>>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

[-- Attachment #2: wistron-no-entry.patch --]
[-- Type: text/x-patch, Size: 925 bytes --]

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.

Signed-off-by: Miloslav Trmac <mitr@volny.cz>

--- a/drivers/input/misc/wistron_btns.c	Sun Jan  8 06:30:59 2006
+++ b/drivers/input/misc/wistron_btns.c	Sun Jan  8 08:46:26 2006
@@ -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 */

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

* Re: [PATCH] wistron_btns: Fix missing BIOS signature handling, take 2
  2006-01-08  7:52   ` [PATCH] wistron_btns: Fix missing BIOS signature handling, take 2 Miloslav Trmac
@ 2006-01-08 16:13     ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2006-01-08 16:13 UTC (permalink / raw)
  To: Miloslav Trmac; +Cc: Linux Kernel Mailing List

On Sunday 08 January 2006 02:52, Miloslav Trmac wrote:
> Dmitry Torokhov wrote:
> > On Sunday 08 January 2006 01:39, Miloslav Trmac wrote:
> > 
> >>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.

-- 
Dmitry

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

end of thread, other threads:[~2006-01-08 16:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-08  6:39 [PATCH] wistron_btns: Fix missing BIOS signature handling Miloslav Trmac
2006-01-08  6:58 ` Dmitry Torokhov
2006-01-08  7:52   ` [PATCH] wistron_btns: Fix missing BIOS signature handling, take 2 Miloslav Trmac
2006-01-08 16:13     ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).