diff options
Diffstat (limited to 'drivers/input/joystick/analog.c')
-rw-r--r-- | drivers/input/joystick/analog.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c index 3121961e3e7c..01dc0b195d59 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c | |||
@@ -408,21 +408,23 @@ static void analog_calibrate_timer(struct analog_port *port) | |||
408 | 408 | ||
409 | static void analog_name(struct analog *analog) | 409 | static void analog_name(struct analog *analog) |
410 | { | 410 | { |
411 | sprintf(analog->name, "Analog %d-axis %d-button", | 411 | snprintf(analog->name, sizeof(analog->name), "Analog %d-axis %d-button", |
412 | hweight8(analog->mask & ANALOG_AXES_STD), | 412 | hweight8(analog->mask & ANALOG_AXES_STD), |
413 | hweight8(analog->mask & ANALOG_BTNS_STD) + !!(analog->mask & ANALOG_BTNS_CHF) * 2 + | 413 | hweight8(analog->mask & ANALOG_BTNS_STD) + !!(analog->mask & ANALOG_BTNS_CHF) * 2 + |
414 | hweight16(analog->mask & ANALOG_BTNS_GAMEPAD) + !!(analog->mask & ANALOG_HBTN_CHF) * 4); | 414 | hweight16(analog->mask & ANALOG_BTNS_GAMEPAD) + !!(analog->mask & ANALOG_HBTN_CHF) * 4); |
415 | 415 | ||
416 | if (analog->mask & ANALOG_HATS_ALL) | 416 | if (analog->mask & ANALOG_HATS_ALL) |
417 | sprintf(analog->name, "%s %d-hat", | 417 | snprintf(analog->name, sizeof(analog->name), "%s %d-hat", |
418 | analog->name, hweight16(analog->mask & ANALOG_HATS_ALL)); | 418 | analog->name, hweight16(analog->mask & ANALOG_HATS_ALL)); |
419 | 419 | ||
420 | if (analog->mask & ANALOG_HAT_FCS) | 420 | if (analog->mask & ANALOG_HAT_FCS) |
421 | strcat(analog->name, " FCS"); | 421 | strlcat(analog->name, " FCS", sizeof(analog->name)); |
422 | if (analog->mask & ANALOG_ANY_CHF) | 422 | if (analog->mask & ANALOG_ANY_CHF) |
423 | strcat(analog->name, (analog->mask & ANALOG_SAITEK) ? " Saitek" : " CHF"); | 423 | strlcat(analog->name, (analog->mask & ANALOG_SAITEK) ? " Saitek" : " CHF", |
424 | sizeof(analog->name)); | ||
424 | 425 | ||
425 | strcat(analog->name, (analog->mask & ANALOG_GAMEPAD) ? " gamepad": " joystick"); | 426 | strlcat(analog->name, (analog->mask & ANALOG_GAMEPAD) ? " gamepad": " joystick", |
427 | sizeof(analog->name)); | ||
426 | } | 428 | } |
427 | 429 | ||
428 | /* | 430 | /* |
@@ -435,7 +437,8 @@ static int analog_init_device(struct analog_port *port, struct analog *analog, i | |||
435 | int i, j, t, v, w, x, y, z; | 437 | int i, j, t, v, w, x, y, z; |
436 | 438 | ||
437 | analog_name(analog); | 439 | analog_name(analog); |
438 | sprintf(analog->phys, "%s/input%d", port->gameport->phys, index); | 440 | snprintf(analog->phys, sizeof(analog->phys), |
441 | "%s/input%d", port->gameport->phys, index); | ||
439 | analog->buttons = (analog->mask & ANALOG_GAMEPAD) ? analog_pad_btn : analog_joy_btn; | 442 | analog->buttons = (analog->mask & ANALOG_GAMEPAD) ? analog_pad_btn : analog_joy_btn; |
440 | 443 | ||
441 | analog->dev = input_dev = input_allocate_device(); | 444 | analog->dev = input_dev = input_allocate_device(); |