aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/class')
-rw-r--r--drivers/usb/class/usbtmc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index f2fde7cd6109..91d3a94eeaa0 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -473,6 +473,10 @@ static ssize_t usbtmc_read(struct file *filp, char __user *buf,
473 n_characters = this_part; 473 n_characters = this_part;
474 } 474 }
475 475
476 /* Bound amount of data received by amount of data requested */
477 if (n_characters > this_part)
478 n_characters = this_part;
479
476 /* Copy buffer to user space */ 480 /* Copy buffer to user space */
477 if (copy_to_user(buf + done, &buffer[12], n_characters)) { 481 if (copy_to_user(buf + done, &buffer[12], n_characters)) {
478 /* There must have been an addressing problem */ 482 /* There must have been an addressing problem */