diff options
-rw-r--r-- | drivers/hid/uhid.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index bf13746d1731..5dee8bd60745 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c | |||
@@ -363,7 +363,7 @@ static int uhid_dev_create2(struct uhid_device *uhid, | |||
363 | const struct uhid_event *ev) | 363 | const struct uhid_event *ev) |
364 | { | 364 | { |
365 | struct hid_device *hid; | 365 | struct hid_device *hid; |
366 | size_t rd_size; | 366 | size_t rd_size, len; |
367 | void *rd_data; | 367 | void *rd_data; |
368 | int ret; | 368 | int ret; |
369 | 369 | ||
@@ -387,12 +387,12 @@ static int uhid_dev_create2(struct uhid_device *uhid, | |||
387 | goto err_free; | 387 | goto err_free; |
388 | } | 388 | } |
389 | 389 | ||
390 | strncpy(hid->name, ev->u.create2.name, 127); | 390 | len = min(sizeof(hid->name), sizeof(ev->u.create2.name)) - 1; |
391 | hid->name[127] = 0; | 391 | strncpy(hid->name, ev->u.create2.name, len); |
392 | strncpy(hid->phys, ev->u.create2.phys, 63); | 392 | len = min(sizeof(hid->phys), sizeof(ev->u.create2.phys)) - 1; |
393 | hid->phys[63] = 0; | 393 | strncpy(hid->phys, ev->u.create2.phys, len); |
394 | strncpy(hid->uniq, ev->u.create2.uniq, 63); | 394 | len = min(sizeof(hid->uniq), sizeof(ev->u.create2.uniq)) - 1; |
395 | hid->uniq[63] = 0; | 395 | strncpy(hid->uniq, ev->u.create2.uniq, len); |
396 | 396 | ||
397 | hid->ll_driver = &uhid_hid_driver; | 397 | hid->ll_driver = &uhid_hid_driver; |
398 | hid->bus = ev->u.create2.bus; | 398 | hid->bus = ev->u.create2.bus; |