linux/drivers/usb/typec
Arnd Bergmann 8160eac121 usb: typec: avoid format-overflow warning
gcc-8 points out that the fix-byte buffer might be too small if
desc->mode is a three-digit number:

drivers/usb/typec/class.c: In function 'typec_register_altmode':
drivers/usb/typec/class.c:502:32: error: '%d' directive writing between 1 and 3 bytes into a region of size 2 [-Werror=format-overflow=]
  sprintf(alt->group_name, "mode%d", desc->mode);
                                ^~
drivers/usb/typec/class.c:502:27: note: directive argument in the range [0, 255]
  sprintf(alt->group_name, "mode%d", desc->mode);
                           ^~~~~~~~
drivers/usb/typec/class.c:502:2: note: 'sprintf' output between 6 and 8 bytes into a destination of size 6
  sprintf(alt->group_name, "mode%d", desc->mode);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I assume this cannot happen in practice, but we can simply make the
string long enough to avoid the warning. This uses the two padding
bytes that already exist after the string.

Fixes: 4ab8c18d4d ("usb: typec: Register a device for every mode")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-06 16:36:19 +02:00
..
altmodes usb: typec: unlock dp->lock on error exit path, and also zero ret if successful 2018-07-06 16:36:19 +02:00
fusb302 USB: typec: fsusb302: Drop empty set_current_limit implementation 2018-07-02 18:08:19 +02:00
mux usb: typec: pi3usb30532: Start using generic state values 2018-07-02 17:42:36 +02:00
ucsi usb: typec: ucsi: Fix for incorrect status data issue 2018-06-25 21:30:12 +08:00
bus.c usb: typec: fix dereference before null check on adev 2018-07-06 16:36:19 +02:00
bus.h usb: typec: avoid format-overflow warning 2018-07-06 16:36:19 +02:00
class.c usb: typec: Bus type for alternate modes 2018-07-02 17:42:36 +02:00
Kconfig usb: typec: Add driver for DisplayPort alternate mode 2018-07-02 17:42:36 +02:00
Makefile usb: typec: Add driver for DisplayPort alternate mode 2018-07-02 17:42:36 +02:00
mux.c usb: typec: mux: Get the mux identifier from function parameter 2018-07-02 17:42:36 +02:00
tcpci.c staging: typec: tcpci: move tcpci drivers out of staging 2018-06-28 19:49:48 +09:00
tcpci.h staging: typec: tcpci: move tcpci drivers out of staging 2018-06-28 19:49:48 +09:00
tcpci_rt1711h.c staging: typec: tcpci: move tcpci drivers out of staging 2018-06-28 19:49:48 +09:00
tcpm.c usb: typec: tcpm: Support for Alternate Modes 2018-07-02 17:42:36 +02:00
tps6598x.c usb: typec: tps6598x: Remove VLA usage 2018-06-28 19:49:46 +09:00
typec_wcove.c usb: typec: wcove: Remove dependency on HW FSM 2018-05-24 18:17:00 +02:00