]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.16.4/hid-fix-hid_report_len-usage.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.16.4 / hid-fix-hid_report_len-usage.patch
1 From 3064a03b94e60388f0955fcc29f3e8a978d28f75 Mon Sep 17 00:00:00 2001
2 From: Aaron Ma <aaron.ma@canonical.com>
3 Date: Sat, 3 Feb 2018 23:57:15 +0800
4 Subject: HID: Fix hid_report_len usage
5
6 From: Aaron Ma <aaron.ma@canonical.com>
7
8 commit 3064a03b94e60388f0955fcc29f3e8a978d28f75 upstream.
9
10 Follow the change of return type u32 of hid_report_len,
11 fix all the types of variables those get the return value of
12 hid_report_len to u32, and all other code already uses u32.
13
14 Cc: stable@vger.kernel.org
15 Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
16 Signed-off-by: Jiri Kosina <jkosina@suse.cz>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19 ---
20 drivers/hid/hid-input.c | 3 ++-
21 drivers/hid/hid-multitouch.c | 5 +++--
22 drivers/hid/hid-rmi.c | 4 ++--
23 drivers/hid/wacom_sys.c | 4 ++--
24 4 files changed, 9 insertions(+), 7 deletions(-)
25
26 --- a/drivers/hid/hid-input.c
27 +++ b/drivers/hid/hid-input.c
28 @@ -1368,7 +1368,8 @@ static void hidinput_led_worker(struct w
29 led_work);
30 struct hid_field *field;
31 struct hid_report *report;
32 - int len, ret;
33 + int ret;
34 + u32 len;
35 __u8 *buf;
36
37 field = hidinput_get_led_field(hid);
38 --- a/drivers/hid/hid-multitouch.c
39 +++ b/drivers/hid/hid-multitouch.c
40 @@ -370,7 +370,8 @@ static const struct attribute_group mt_a
41 static void mt_get_feature(struct hid_device *hdev, struct hid_report *report)
42 {
43 struct mt_device *td = hid_get_drvdata(hdev);
44 - int ret, size = hid_report_len(report);
45 + int ret;
46 + u32 size = hid_report_len(report);
47 u8 *buf;
48
49 /*
50 @@ -1183,7 +1184,7 @@ static void mt_set_input_mode(struct hid
51 struct hid_report_enum *re;
52 struct mt_class *cls = &td->mtclass;
53 char *buf;
54 - int report_len;
55 + u32 report_len;
56
57 if (td->inputmode < 0)
58 return;
59 --- a/drivers/hid/hid-rmi.c
60 +++ b/drivers/hid/hid-rmi.c
61 @@ -89,8 +89,8 @@ struct rmi_data {
62 u8 *writeReport;
63 u8 *readReport;
64
65 - int input_report_size;
66 - int output_report_size;
67 + u32 input_report_size;
68 + u32 output_report_size;
69
70 unsigned long flags;
71
72 --- a/drivers/hid/wacom_sys.c
73 +++ b/drivers/hid/wacom_sys.c
74 @@ -219,7 +219,7 @@ static void wacom_feature_mapping(struct
75 unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid);
76 u8 *data;
77 int ret;
78 - int n;
79 + u32 n;
80
81 switch (equivalent_usage) {
82 case HID_DG_CONTACTMAX:
83 @@ -519,7 +519,7 @@ static int wacom_set_device_mode(struct
84 u8 *rep_data;
85 struct hid_report *r;
86 struct hid_report_enum *re;
87 - int length;
88 + u32 length;
89 int error = -ENOMEM, limit = 0;
90
91 if (wacom_wac->mode_report < 0)