summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/hid
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/hid')
-rw-r--r--kernel/drivers/hid/hid-cp2112.c2
-rw-r--r--kernel/drivers/hid/hid-input.c7
-rw-r--r--kernel/drivers/hid/hid-uclogic.c2
3 files changed, 8 insertions, 3 deletions
diff --git a/kernel/drivers/hid/hid-cp2112.c b/kernel/drivers/hid/hid-cp2112.c
index 3318de690..a2dbbbe0d 100644
--- a/kernel/drivers/hid/hid-cp2112.c
+++ b/kernel/drivers/hid/hid-cp2112.c
@@ -356,6 +356,8 @@ static int cp2112_read(struct cp2112_device *dev, u8 *data, size_t size)
struct cp2112_force_read_report report;
int ret;
+ if (size > sizeof(dev->read_data))
+ size = sizeof(dev->read_data);
report.report = CP2112_DATA_READ_FORCE_SEND;
report.length = cpu_to_be16(size);
diff --git a/kernel/drivers/hid/hid-input.c b/kernel/drivers/hid/hid-input.c
index 008e89bf6..32d52d29c 100644
--- a/kernel/drivers/hid/hid-input.c
+++ b/kernel/drivers/hid/hid-input.c
@@ -462,12 +462,15 @@ out:
static void hidinput_cleanup_battery(struct hid_device *dev)
{
+ const struct power_supply_desc *psy_desc;
+
if (!dev->battery)
return;
+ psy_desc = dev->battery->desc;
power_supply_unregister(dev->battery);
- kfree(dev->battery->desc->name);
- kfree(dev->battery->desc);
+ kfree(psy_desc->name);
+ kfree(psy_desc);
dev->battery = NULL;
}
#else /* !CONFIG_HID_BATTERY_STRENGTH */
diff --git a/kernel/drivers/hid/hid-uclogic.c b/kernel/drivers/hid/hid-uclogic.c
index 94167310e..b905d501e 100644
--- a/kernel/drivers/hid/hid-uclogic.c
+++ b/kernel/drivers/hid/hid-uclogic.c
@@ -858,7 +858,7 @@ static int uclogic_tablet_enable(struct hid_device *hdev)
for (p = drvdata->rdesc;
p <= drvdata->rdesc + drvdata->rsize - 4;) {
if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D &&
- p[3] < sizeof(params)) {
+ p[3] < ARRAY_SIZE(params)) {
v = params[p[3]];
put_unaligned(cpu_to_le32(v), (s32 *)p);
p += 4;