From akpm@osdl.org Wed Jul 27 01:14:04 2005
Message-Id: <200507270809.j6R89Q2u009555@shell0.pdx.osdl.net>
Subject: USB: hidinput_hid_event() oops fix
From: Pete Zaitcev <zaitcev@redhat.com>
To: greg@kroah.com
Date: Wed, 27 Jul 2005 01:08:29 -0700



It seems that I see a bug in hidinput_hid_event.  The check for NULL can never
work, becaue &hidinput->input is nonzero at all times.

Cc: <vojtech@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/usb/input/hid-input.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

--- gregkh-2.6.orig/drivers/usb/input/hid-input.c	2005-07-13 09:45:06.000000000 -0700
+++ gregkh-2.6/drivers/usb/input/hid-input.c	2005-07-27 22:34:08.000000000 -0700
@@ -397,11 +397,12 @@
 
 void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs)
 {
-	struct input_dev *input = &field->hidinput->input;
+	struct input_dev *input;
 	int *quirks = &hid->quirks;
 
-	if (!input)
+	if (!field->hidinput)
 		return;
+	input = &field->hidinput->input;
 
 	input_regs(input, regs);