On Wed, Oct 25, 2023 at 4:51 PM Joe Perches <joe@xxxxxxxxxxx> wrote: > > On Wed, 2023-10-25 at 23:40 +0000, Justin Stitt wrote: > > This patch converts some basic cases of ethtool_sprintf() to > > ethtool_puts(). > > > > The conversions are used in cases where ethtool_sprintf() was being used > > with just two arguments: > > > ethtool_sprintf(&data, buffer[i].name); > > OK. > > > or when it's used with format string: "%s" > > > ethtool_sprintf(&data, "%s", buffer[i].name); > > > which both now become: > > > ethtool_puts(&data, buffer[i].name); > > Why do you want this conversion? > Is it not possible for .name to contain a formatting field? The case of using just two arguments to a ethtool_sprintf call may cause -Wformat-security warnings. If it did indeed have format specifiers then we would have more format specifiers than arguments. Not ideal. The second case of having a standalone "%s" isn't necessarily bad or wrong. I used this exact approach to replace some strncpy() usage in net drivers [1]. I'm working off guidance from Andrew Lunn [2] and Kees who said it may be a good idea to tidy this up with a puts(). All in all, this patch doesn't do much but fix some warnings and provide a more obvious interface. The number of actual replacements are relatively low (around 20ish) so I was hoping to sneak them in via this series. > [1]: https://lore.kernel.org/all/?q=dfb%3Aethtool_sprintf+AND+f%3Ajustinstitt [2]: https://lore.kernel.org/all/a958d35e-98b6-4a95-b505-776482d1150c@xxxxxxx/ Thanks Justin