diff options
| author | martin coulon <martinusbe@gmail.com> | 2018-07-11 23:20:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-11 23:20:51 +0200 |
| commit | 14c6f2d81a3d3f0ab7e3a8a73714d16a64bd420d (patch) | |
| tree | 9216b5b9335d52a6134c26b5bf54ef2e5c7fdf13 /drivers/hid/hid-debug.c | |
| parent | 32769b627546b549eaaa5e60dfa761a38f87da88 (diff) | |
| parent | 29b340530c2f792a824afdbcd3b1cc0a47e9b631 (diff) | |
Merge 3.18.115 into 8.1
Diffstat (limited to 'drivers/hid/hid-debug.c')
| -rw-r--r-- | drivers/hid/hid-debug.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index 8bf61d295ffd..7192fa1d2786 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c @@ -1150,6 +1150,8 @@ copy_rest: goto out; if (list->tail > list->head) { len = list->tail - list->head; + if (len > count) + len = count; if (copy_to_user(buffer + ret, &list->hid_debug_buf[list->head], len)) { ret = -EFAULT; @@ -1159,6 +1161,8 @@ copy_rest: list->head += len; } else { len = HID_DEBUG_BUFSIZE - list->head; + if (len > count) + len = count; if (copy_to_user(buffer, &list->hid_debug_buf[list->head], len)) { ret = -EFAULT; @@ -1166,7 +1170,9 @@ copy_rest: } list->head = 0; ret += len; - goto copy_rest; + count -= len; + if (count > 0) + goto copy_rest; } } |
