[PATCH 0/3] ethtool: Add ethtool_puts()

2023-10-25 Thread Justin Stitt
ion VAR; @@ - ethtool_sprintf + ethtool_puts (&BUF, VAR) @replace_3_args@ identifier BUF; expression VAR; @@ - ethtool_sprintf(&BUF, "%s", VAR) + ethtool_puts(&BUF, VAR) [5]: $ rg "ethtool_sprintf\(\s*[^,)]+\s*,\s*[^,)]+\s*\)"

[PATCH 1/3] ethtool: Implement ethtool_puts()

2023-10-25 Thread Justin Stitt
Use strscpy() to implement ethtool_puts(). Functionally the same as ethtool_sprintf() when it's used with two arguments or with just "%s" format specifier. Signed-off-by: Justin Stitt --- include/linux/ethtool.h | 13 + net/ethtool/ioctl.c | 7 +++ 2 fi

[PATCH 2/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-25 Thread Justin Stitt
-is but I will send new versions for the others. [1]: https://lore.kernel.org/all/?q=dfb%3Aethtool_sprintf+AND+f%3Ajustinstitt Signed-off-by: Justin Stitt --- drivers/net/ethernet/amazon/ena/ena_ethtool.c | 4 +- drivers/net/ethernet/brocade/bna/bnad_ethtool.c| 2 +- .../net/ethernet

[PATCH 3/3] checkpatch: add ethtool_sprintf rules

2023-10-25 Thread Justin Stitt
thtool_sprintf(&data, "%s", driver[i].name); The former may cause -Wformat-security warnings while the latter is just not preferred. Both are safely in the category of warnings, not errors. Signed-off-by: Justin Stitt --- scripts/checkpatch.pl | 13 + 1 file changed, 13

Re: [PATCH 2/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-25 Thread Justin Stitt
On Wed, Oct 25, 2023 at 4:51 PM Joe Perches wrote: > > On Wed, 2023-10-25 at 23:40 +, Justin Stitt wrote: > > This patch converts some basic cases of ethtool_sprintf() to > > ethtool_puts(). > > > > The conversions are used in cases where ethtool_sprintf() wa

[PATCH next v2 0/3] ethtool: Add ethtool_puts()

2023-10-26 Thread Justin Stitt
ethtool_sprintf(BUF, "%s", VAR) + ethtool_puts(BUF, VAR) - ethtool_sprintf(&BUF, "%s", VAR) + ethtool_puts(&BUF, VAR) [5]: $ rg "ethtool_sprintf\(\s*[^,)]+\s*,\s*[^,)]+\s*\)" Signed-off-by: Justin Stitt --- Changes in v2: - wrap lines better in replaceme

[PATCH next v2 2/3] checkpatch: add ethtool_sprintf rules

2023-10-26 Thread Justin Stitt
thtool_sprintf(&data, "%s", driver[i].name); The former may cause -Wformat-security warnings while the latter is just not preferred. Both are safely in the category of warnings, not errors. Signed-off-by: Justin Stitt --- scripts/checkpatch.pl | 19 +++ 1 file cha

[PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-26 Thread Justin Stitt
Use strscpy() to implement ethtool_puts(). Functionally the same as ethtool_sprintf() when it's used with two arguments or with just "%s" format specifier. Signed-off-by: Justin Stitt --- include/linux/ethtool.h | 34 +++--- net/ethtool/ioctl.c

[PATCH next v2 3/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-26 Thread Justin Stitt
htool_sprintf(&data, "%s", buffer[i].name); which both now become: | ethtool_puts(&data, buffer[i].name); Signed-off-by: Justin Stitt --- drivers/net/dsa/lantiq_gswip.c | 2 +- drivers/net/dsa/mt7530.c | 2 +

Re: [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-26 Thread Justin Stitt
On Thu, Oct 26, 2023 at 3:02 PM Vladimir Oltean wrote: > > Hi Justin, > > On Thu, Oct 26, 2023 at 09:56:07PM +0000, Justin Stitt wrote: > > Use strscpy() to implement ethtool_puts(). > > > > Functionally the same as ethtool_sprintf() when it's used with two >

Re: [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-26 Thread Justin Stitt
On Thu, Oct 26, 2023 at 3:09 PM Justin Stitt wrote: > > On Thu, Oct 26, 2023 at 3:02 PM Vladimir Oltean wrote: > > > > Hi Justin, > > > > On Thu, Oct 26, 2023 at 09:56:07PM +, Justin Stitt wrote: > > > Use strscpy() to implement ethtool_puts(

Re: [PATCH next v2 2/3] checkpatch: add ethtool_sprintf rules

2023-10-26 Thread Justin Stitt
On Thu, Oct 26, 2023 at 3:12 PM Vladimir Oltean wrote: > > On Thu, Oct 26, 2023 at 09:56:08PM +, Justin Stitt wrote: > > Add some warnings for using ethtool_sprintf() where a simple > > ethtool_puts() would suffice. > > > > The two cases are: > > > &

Re: [PATCH next v2 0/3] ethtool: Add ethtool_puts()

2023-10-27 Thread Justin Stitt
On Thu, Oct 26, 2023 at 5:25 PM Andrew Lunn wrote: > > > Changes in v2: > > - wrap lines better in replacement (thanks Joe, Kees) > > - add --fix to checkpatch (thanks Joe) > > - clean up checkpatch formatting (thanks Joe, et al.) > > - rebase against next > > Please could you explain the rebase a

Re: [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-27 Thread Justin Stitt
On Thu, Oct 26, 2023 at 3:25 PM Vladimir Oltean wrote: > > On Thu, Oct 26, 2023 at 03:09:59PM -0700, Justin Stitt wrote: > > Should I undo this? I want my patch against next since it's targeting > > some stuff in-flight over there. BUT, I also want ethtool_puts() t

Re: [PATCH next v2 2/3] checkpatch: add ethtool_sprintf rules

2023-10-27 Thread Justin Stitt
On Thu, Oct 26, 2023 at 3:39 PM Joe Perches wrote: > > On Thu, 2023-10-26 at 21:56 +, Justin Stitt wrote: > > Add some warnings for using ethtool_sprintf() where a simple > > ethtool_puts() would suffice. > [] > > diff --git a/scripts/checkpatch.pl b/scripts/checkp

[PATCH net-next v3 1/3] ethtool: Implement ethtool_puts()

2023-10-27 Thread Justin Stitt
Use strscpy() to implement ethtool_puts(). Functionally the same as ethtool_sprintf() when it's used with two arguments or with just "%s" format specifier. Signed-off-by: Justin Stitt --- include/linux/ethtool.h | 13 + net/ethtool/ioctl.c | 7 +++ 2 fi

[PATCH net-next v3 0/3] ethtool: Add ethtool_puts()

2023-10-27 Thread Justin Stitt
ethtool_sprintf(BUF, "%s", VAR) + ethtool_puts(BUF, VAR) - ethtool_sprintf(&BUF, "%s", VAR) + ethtool_puts(&BUF, VAR) [5]: $ rg "ethtool_sprintf\(\s*[^,)]+\s*,\s*[^,)]+\s*\)" Signed-off-by: Justin Stitt --- Changes in v3: - fix force_speed_maps merge

[PATCH net-next v3 2/3] checkpatch: add ethtool_sprintf rules

2023-10-27 Thread Justin Stitt
thtool_sprintf(&data, "%s", driver[i].name); The former may cause -Wformat-security warnings while the latter is just not preferred. Both are safely in the category of warnings, not errors. Signed-off-by: Justin Stitt --- scripts/checkpatch.pl | 19 +++ 1 file cha

[PATCH net-next v3 3/3] net: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-27 Thread Justin Stitt
htool_sprintf(&data, "%s", buffer[i].name); which both now become: | ethtool_puts(&data, buffer[i].name); Signed-off-by: Justin Stitt --- drivers/net/dsa/lantiq_gswip.c | 2 +- drivers/net/dsa/mt7530.c | 2 +

Re: [PATCH net-next v3 1/3] ethtool: Implement ethtool_puts()

2023-10-27 Thread Justin Stitt
On Fri, Oct 27, 2023 at 4:43 PM Andrew Lunn wrote: > > > +/** > > + * ethtool_puts - Write string to ethtool string data > > + * @data: Pointer to start of string to update > > Isn't it actually a pointer to a pointer to the start of string to > update? I suppose. FWIW, I just copy-pasted the sp

[PATCH net-next v4 1/3] ethtool: Implement ethtool_puts()

2023-11-02 Thread Justin Stitt
Use strscpy() to implement ethtool_puts(). Functionally the same as ethtool_sprintf() when it's used with two arguments or with just "%s" format specifier. Signed-off-by: Justin Stitt --- include/linux/ethtool.h | 13 + net/ethtool/ioctl.c | 7 +++ 2 fi

[PATCH net-next v4 3/3] net: Convert some ethtool_sprintf() to ethtool_puts()

2023-11-02 Thread Justin Stitt
htool_sprintf(&data, "%s", buffer[i].name); which both now become: | ethtool_puts(&data, buffer[i].name); Signed-off-by: Justin Stitt --- drivers/net/dsa/lantiq_gswip.c | 2 +- drivers/net/dsa/mt7530.c | 2 +

[PATCH net-next v4 2/3] checkpatch: add ethtool_sprintf rules

2023-11-02 Thread Justin Stitt
thtool_sprintf(&data, "%s", driver[i].name); The former may cause -Wformat-security warnings while the latter is just not preferred. Both are safely in the category of warnings, not errors. Signed-off-by: Justin Stitt --- scripts/checkpatch.pl | 19 +++ 1 file cha

[PATCH net-next v4 0/3] ethtool: Add ethtool_puts()

2023-11-02 Thread Justin Stitt
BUF, VAR) + ethtool_puts(BUF, VAR) @replace_3_args@ expression BUF; expression VAR; @@ - ethtool_sprintf(BUF, "%s", VAR) + ethtool_puts(BUF, VAR) - ethtool_sprintf(&BUF, "%s", VAR) + ethtool_puts(&BUF, VAR) [5]: $ rg "ethtool_sprin