提交 70d215c4 编写于 作者: F Fengguang Wu 提交者: Jiri Kosina

HID: the `bit' in hidinput_mapping_quirks() is an out parameter

Fix a panic, by changing
	hidinput_mapping_quirks(,, unsigned long *bit,)
to
	hidinput_mapping_quirks(,, unsigned long **bit,)

The `bit' in this function is an out parameter.
Signed-off-by: NFengguang Wu <wfg@mail.ustc.edu.cn>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 c4124c9b
...@@ -16,16 +16,16 @@ ...@@ -16,16 +16,16 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/hid.h> #include <linux/hid.h>
#define map_abs(c) do { usage->code = c; usage->type = EV_ABS; bit = input->absbit; *max = ABS_MAX; } while (0) #define map_abs(c) do { usage->code = c; usage->type = EV_ABS; *bit = input->absbit; *max = ABS_MAX; } while (0)
#define map_rel(c) do { usage->code = c; usage->type = EV_REL; bit = input->relbit; *max = REL_MAX; } while (0) #define map_rel(c) do { usage->code = c; usage->type = EV_REL; *bit = input->relbit; *max = REL_MAX; } while (0)
#define map_key(c) do { usage->code = c; usage->type = EV_KEY; bit = input->keybit; *max = KEY_MAX; } while (0) #define map_key(c) do { usage->code = c; usage->type = EV_KEY; *bit = input->keybit; *max = KEY_MAX; } while (0)
#define map_led(c) do { usage->code = c; usage->type = EV_LED; bit = input->ledbit; *max = LED_MAX; } while (0) #define map_led(c) do { usage->code = c; usage->type = EV_LED; *bit = input->ledbit; *max = LED_MAX; } while (0)
#define map_abs_clear(c) do { map_abs(c); clear_bit(c, bit); } while (0) #define map_abs_clear(c) do { map_abs(c); clear_bit(c, *bit); } while (0)
#define map_key_clear(c) do { map_key(c); clear_bit(c, bit); } while (0) #define map_key_clear(c) do { map_key(c); clear_bit(c, *bit); } while (0)
static int quirk_belkin_wkbd(struct hid_usage *usage, struct input_dev *input, static int quirk_belkin_wkbd(struct hid_usage *usage, struct input_dev *input,
unsigned long *bit, int *max) unsigned long **bit, int *max)
{ {
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
return 0; return 0;
...@@ -41,7 +41,7 @@ static int quirk_belkin_wkbd(struct hid_usage *usage, struct input_dev *input, ...@@ -41,7 +41,7 @@ static int quirk_belkin_wkbd(struct hid_usage *usage, struct input_dev *input,
} }
static int quirk_cherry_cymotion(struct hid_usage *usage, struct input_dev *input, static int quirk_cherry_cymotion(struct hid_usage *usage, struct input_dev *input,
unsigned long *bit, int *max) unsigned long **bit, int *max)
{ {
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
return 0; return 0;
...@@ -57,7 +57,7 @@ static int quirk_cherry_cymotion(struct hid_usage *usage, struct input_dev *inpu ...@@ -57,7 +57,7 @@ static int quirk_cherry_cymotion(struct hid_usage *usage, struct input_dev *inpu
} }
static int quirk_logitech_ultrax_remote(struct hid_usage *usage, struct input_dev *input, static int quirk_logitech_ultrax_remote(struct hid_usage *usage, struct input_dev *input,
unsigned long *bit, int *max) unsigned long **bit, int *max)
{ {
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
return 0; return 0;
...@@ -90,7 +90,7 @@ static int quirk_logitech_ultrax_remote(struct hid_usage *usage, struct input_de ...@@ -90,7 +90,7 @@ static int quirk_logitech_ultrax_remote(struct hid_usage *usage, struct input_de
} }
static int quirk_chicony_tactical_pad(struct hid_usage *usage, struct input_dev *input, static int quirk_chicony_tactical_pad(struct hid_usage *usage, struct input_dev *input,
unsigned long *bit, int *max) unsigned long **bit, int *max)
{ {
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR) if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
return 0; return 0;
...@@ -115,7 +115,7 @@ static int quirk_chicony_tactical_pad(struct hid_usage *usage, struct input_dev ...@@ -115,7 +115,7 @@ static int quirk_chicony_tactical_pad(struct hid_usage *usage, struct input_dev
} }
static int quirk_microsoft_ergonomy_kb(struct hid_usage *usage, struct input_dev *input, static int quirk_microsoft_ergonomy_kb(struct hid_usage *usage, struct input_dev *input,
unsigned long *bit, int *max) unsigned long **bit, int *max)
{ {
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR) if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
return 0; return 0;
...@@ -138,7 +138,7 @@ static int quirk_microsoft_ergonomy_kb(struct hid_usage *usage, struct input_dev ...@@ -138,7 +138,7 @@ static int quirk_microsoft_ergonomy_kb(struct hid_usage *usage, struct input_dev
} }
static int quirk_microsoft_presenter_8k(struct hid_usage *usage, struct input_dev *input, static int quirk_microsoft_presenter_8k(struct hid_usage *usage, struct input_dev *input,
unsigned long *bit, int *max) unsigned long **bit, int *max)
{ {
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR) if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
return 0; return 0;
...@@ -156,7 +156,7 @@ static int quirk_microsoft_presenter_8k(struct hid_usage *usage, struct input_de ...@@ -156,7 +156,7 @@ static int quirk_microsoft_presenter_8k(struct hid_usage *usage, struct input_de
} }
static int quirk_petalynx_remote(struct hid_usage *usage, struct input_dev *input, static int quirk_petalynx_remote(struct hid_usage *usage, struct input_dev *input,
unsigned long *bit, int *max) unsigned long **bit, int *max)
{ {
if (((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) && if (((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) &&
((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)) ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER))
...@@ -184,7 +184,7 @@ static int quirk_petalynx_remote(struct hid_usage *usage, struct input_dev *inpu ...@@ -184,7 +184,7 @@ static int quirk_petalynx_remote(struct hid_usage *usage, struct input_dev *inpu
} }
static int quirk_logitech_wireless(struct hid_usage *usage, struct input_dev *input, static int quirk_logitech_wireless(struct hid_usage *usage, struct input_dev *input,
unsigned long *bit, int *max) unsigned long **bit, int *max)
{ {
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
return 0; return 0;
...@@ -236,7 +236,7 @@ static int quirk_logitech_wireless(struct hid_usage *usage, struct input_dev *in ...@@ -236,7 +236,7 @@ static int quirk_logitech_wireless(struct hid_usage *usage, struct input_dev *in
} }
static int quirk_cherry_genius_29e(struct hid_usage *usage, struct input_dev *input, static int quirk_cherry_genius_29e(struct hid_usage *usage, struct input_dev *input,
unsigned long *bit, int *max) unsigned long **bit, int *max)
{ {
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
return 0; return 0;
...@@ -254,7 +254,7 @@ static int quirk_cherry_genius_29e(struct hid_usage *usage, struct input_dev *in ...@@ -254,7 +254,7 @@ static int quirk_cherry_genius_29e(struct hid_usage *usage, struct input_dev *in
} }
static int quirk_btc_8193(struct hid_usage *usage, struct input_dev *input, static int quirk_btc_8193(struct hid_usage *usage, struct input_dev *input,
unsigned long *bit, int *max) unsigned long **bit, int *max)
{ {
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER) if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
return 0; return 0;
...@@ -307,7 +307,7 @@ static int quirk_btc_8193(struct hid_usage *usage, struct input_dev *input, ...@@ -307,7 +307,7 @@ static int quirk_btc_8193(struct hid_usage *usage, struct input_dev *input,
static const struct hid_input_blacklist { static const struct hid_input_blacklist {
__u16 idVendor; __u16 idVendor;
__u16 idProduct; __u16 idProduct;
int (*quirk)(struct hid_usage *, struct input_dev *, unsigned long *, int *); int (*quirk)(struct hid_usage *, struct input_dev *, unsigned long **, int *);
} hid_input_blacklist[] = { } hid_input_blacklist[] = {
{ VENDOR_ID_BELKIN, DEVICE_ID_BELKIN_WIRELESS_KEYBOARD, quirk_belkin_wkbd }, { VENDOR_ID_BELKIN, DEVICE_ID_BELKIN_WIRELESS_KEYBOARD, quirk_belkin_wkbd },
...@@ -335,7 +335,7 @@ static const struct hid_input_blacklist { ...@@ -335,7 +335,7 @@ static const struct hid_input_blacklist {
int hidinput_mapping_quirks(struct hid_usage *usage, int hidinput_mapping_quirks(struct hid_usage *usage,
struct input_dev *input, struct input_dev *input,
unsigned long *bit, int *max) unsigned long **bit, int *max)
{ {
struct hid_device *device = input_get_drvdata(input); struct hid_device *device = input_get_drvdata(input);
int i = 0; int i = 0;
......
...@@ -382,7 +382,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel ...@@ -382,7 +382,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
} }
/* handle input mappings for quirky devices */ /* handle input mappings for quirky devices */
ret = hidinput_mapping_quirks(usage, input, bit, &max); ret = hidinput_mapping_quirks(usage, input, &bit, &max);
if (ret) if (ret)
goto mapped; goto mapped;
......
...@@ -526,7 +526,7 @@ extern void hidinput_disconnect(struct hid_device *); ...@@ -526,7 +526,7 @@ extern void hidinput_disconnect(struct hid_device *);
int hid_set_field(struct hid_field *, unsigned, __s32); int hid_set_field(struct hid_field *, unsigned, __s32);
int hid_input_report(struct hid_device *, int type, u8 *, int, int); int hid_input_report(struct hid_device *, int type, u8 *, int, int);
int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long *, int *); int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *);
void hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); void hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32); int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32);
void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt); void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册