[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1102261156480.2160@pobox.suse.cz>
Date: Sat, 26 Feb 2011 11:58:47 +0100 (CET)
From: Jiri Kosina <jkosina@...e.cz>
To: Rafi Rubin <rafi@...s.upenn.edu>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
micki@...rig.com, rydberg@...omail.se, chatty@...c.fr,
peter.hutterer@...-t.net
Subject: Re: [PATCH 1/2] HID: ntrig don't dereference unclaimed hidinput
On Fri, 25 Feb 2011, Rafi Rubin wrote:
> Moved the claimed input check before dereferencing field->hidinput to
> fix a reported invalid deference bug.
>
> Switched to a goto instead of an extra indent for most of the function.
>
> Signed-off-by: Rafi Rubin <rafi@...s.upenn.edu>
> ---
> Peter Hutterer reported seeing ntrig_event called when field->hidinput
> is NULL.
>
> Seems like a reasonable opportunity to adjust the whitespace a bit.
Hi Rafi,
thanks for the fix. Even though it's obvious in this case what the actual
fix is, I'd prefer to have it separate from the other cleanup changes ...
> ---
> drivers/hid/hid-ntrig.c | 466 ++++++++++++++++++++++++-----------------------
> 1 files changed, 236 insertions(+), 230 deletions(-)
>
> diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
> index beb4034..616f091 100644
> --- a/drivers/hid/hid-ntrig.c
> +++ b/drivers/hid/hid-ntrig.c
> @@ -539,277 +539,283 @@ static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
> static int ntrig_event (struct hid_device *hid, struct hid_field *field,
> struct hid_usage *usage, __s32 value)
> {
> - struct input_dev *input = field->hidinput->input;
> struct ntrig_data *nd = hid_get_drvdata(hid);
> + struct input_dev *input;
> +
> + /* Skip processing if not a claimed input */
> + if (!(hid->claimed & HID_CLAIMED_INPUT))
> + goto not_claimed_input;
Makes me wonder why ntrig would be the only driver needing this ...
perhaps pushing it up the stack would make more sense?
--
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists