aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-device-cdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-device-cdev.c')
-rw-r--r--drivers/firewire/fw-device-cdev.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c
index b1b7edb0d2ad..f9f268861418 100644
--- a/drivers/firewire/fw-device-cdev.c
+++ b/drivers/firewire/fw-device-cdev.c
@@ -274,10 +274,11 @@ static int ioctl_get_info(struct client *client, void __user *arg)
274 274
275 if (get_info.rom != 0) { 275 if (get_info.rom != 0) {
276 void __user *uptr = u64_to_uptr(get_info.rom); 276 void __user *uptr = u64_to_uptr(get_info.rom);
277 size_t length = min(get_info.rom_length, 277 size_t want = get_info.rom_length;
278 client->device->config_rom_length * 4); 278 size_t have = client->device->config_rom_length * 4;
279 279
280 if (copy_to_user(uptr, client->device->config_rom, length)) 280 if (copy_to_user(uptr, client->device->config_rom,
281 min(want, have)))
281 return -EFAULT; 282 return -EFAULT;
282 } 283 }
283 get_info.rom_length = client->device->config_rom_length * 4; 284 get_info.rom_length = client->device->config_rom_length * 4;