Skip to content

Commit 6aedb34

Browse files
authored
Merge pull request linuxwacom#361 from Joshua-Dickens/for-6.4
For 6.4
2 parents 4546bff + 3b8b4b9 commit 6aedb34

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

3.17/wacom_sys.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2314,8 +2314,13 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
23142314
goto fail_quirks;
23152315
}
23162316

2317-
if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR)
2317+
if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) {
23182318
error = hid_hw_open(hdev);
2319+
if (error) {
2320+
hid_err(hdev, "hw open failed\n");
2321+
goto fail_quirks;
2322+
}
2323+
}
23192324

23202325
wacom_set_shared_values(wacom_wac);
23212326
devres_close_group(&hdev->dev, wacom);

3.17/wacom_wac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
841841
/* Enter report */
842842
if ((data[1] & 0xfc) == 0xc0) {
843843
/* serial number of the tool */
844-
wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
844+
wacom->serial[idx] = ((__u64)(data[3] & 0x0f) << 28) +
845845
(data[4] << 20) + (data[5] << 12) +
846846
(data[6] << 4) + (data[7] >> 4);
847847

4.5/wacom_sys.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,7 +2284,9 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
22842284
} else if (strstr(product_name, "Wacom") ||
22852285
strstr(product_name, "wacom") ||
22862286
strstr(product_name, "WACOM")) {
2287-
strscpy(name, product_name, sizeof(name));
2287+
if (strscpy(name, product_name, sizeof(name)) < 0) {
2288+
hid_warn(wacom->hdev, "String overflow while assembling device name");
2289+
}
22882290
} else {
22892291
snprintf(name, sizeof(name), "Wacom %s", product_name);
22902292
}
@@ -2302,7 +2304,9 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
23022304
if (name[strlen(name)-1] == ' ')
23032305
name[strlen(name)-1] = '\0';
23042306
} else {
2305-
strscpy(name, features->name, sizeof(name));
2307+
if (strscpy(name, features->name, sizeof(name)) < 0) {
2308+
hid_warn(wacom->hdev, "String overflow while assembling device name");
2309+
}
23062310
}
23072311

23082312
snprintf(wacom_wac->name, sizeof(wacom_wac->name), "%s%s",
@@ -2470,8 +2474,13 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
24702474
goto fail_quirks;
24712475
}
24722476

2473-
if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR)
2477+
if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) {
24742478
error = hid_hw_open(hdev);
2479+
if (error) {
2480+
hid_err(hdev, "hw open failed\n");
2481+
goto fail_quirks;
2482+
}
2483+
}
24752484

24762485
wacom_set_shared_values(wacom_wac);
24772486
devres_close_group(&hdev->dev, wacom);
@@ -2560,8 +2569,10 @@ static void wacom_wireless_work(struct work_struct *work)
25602569
goto fail;
25612570
}
25622571

2563-
strscpy(wacom_wac->name, wacom_wac1->name,
2564-
sizeof(wacom_wac->name));
2572+
if (strscpy(wacom_wac->name, wacom_wac1->name,
2573+
sizeof(wacom_wac->name)) < 0) {
2574+
hid_warn(wacom->hdev, "String overflow while assembling device name");
2575+
}
25652576
}
25662577

25672578
return;

4.5/wacom_wac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
841841
/* Enter report */
842842
if ((data[1] & 0xfc) == 0xc0) {
843843
/* serial number of the tool */
844-
wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
844+
wacom->serial[idx] = ((__u64)(data[3] & 0x0f) << 28) +
845845
(data[4] << 20) + (data[5] << 12) +
846846
(data[6] << 4) + (data[7] >> 4);
847847

0 commit comments

Comments
 (0)