diff options
Diffstat (limited to 'drivers/hid/hid-picolcd.c')
-rw-r--r-- | drivers/hid/hid-picolcd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c index b2f56a13bcf5..9d8710f8bc79 100644 --- a/drivers/hid/hid-picolcd.c +++ b/drivers/hid/hid-picolcd.c | |||
@@ -1585,11 +1585,11 @@ static ssize_t picolcd_debug_eeprom_write(struct file *f, const char __user *u, | |||
1585 | memset(raw_data, 0, sizeof(raw_data)); | 1585 | memset(raw_data, 0, sizeof(raw_data)); |
1586 | raw_data[0] = *off & 0xff; | 1586 | raw_data[0] = *off & 0xff; |
1587 | raw_data[1] = (*off >> 8) & 0xff; | 1587 | raw_data[1] = (*off >> 8) & 0xff; |
1588 | raw_data[2] = s < 20 ? s : 20; | 1588 | raw_data[2] = min((size_t)20, s); |
1589 | if (*off + raw_data[2] > 0xff) | 1589 | if (*off + raw_data[2] > 0xff) |
1590 | raw_data[2] = 0x100 - *off; | 1590 | raw_data[2] = 0x100 - *off; |
1591 | 1591 | ||
1592 | if (copy_from_user(raw_data+3, u, raw_data[2])) | 1592 | if (copy_from_user(raw_data+3, u, min((u8)20, raw_data[2]))) |
1593 | return -EFAULT; | 1593 | return -EFAULT; |
1594 | resp = picolcd_send_and_wait(data->hdev, REPORT_EE_WRITE, raw_data, | 1594 | resp = picolcd_send_and_wait(data->hdev, REPORT_EE_WRITE, raw_data, |
1595 | sizeof(raw_data)); | 1595 | sizeof(raw_data)); |