usb: Replace snprintf with scnprintf in gether_get_ifname
authorDaniel M German <dmg@turingmachine.org>
Thu, 20 Jun 2019 04:50:38 +0000 (21:50 -0700)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 20 Jun 2019 05:53:11 +0000 (08:53 +0300)
commit37e444c8296c14cb5768a1197b24cfc07ee8e0cd
tree965d31cbe37f6053012fb00b2ebf545238c0df50
parentd29fcf7078bc8be2b6366cbd4418265b53c94fac
usb: Replace snprintf with scnprintf in gether_get_ifname

snprintf returns the actual length of the buffer created; however,
this is not the case if snprintf truncates its parameter.
See https://lwn.net/Articles/69419/ for a detailed explanation.
The current code correctly handles this case at the expense
of extra code in the return statement.

scnprintf does returns the actual length of the buffer created
making the ?: operator unnecessary in the return
statement.

This change does not alter the functionality of the code.

Signed-off-by: Daniel M German <dmg@turingmachine.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/u_ether.c