[Intel-wired-lan] [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

[Intel-wired-lan] [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 +

[Intel-wired-lan] [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

[Intel-wired-lan] [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

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

2023-10-30 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

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

2023-10-30 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 +

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

2023-10-30 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

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

2023-10-30 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

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

2023-10-30 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

Re: [Intel-wired-lan] [PATCH next v2 2/3] checkpatch: add ethtool_sprintf rules

2023-10-30 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

Re: [Intel-wired-lan] [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-30 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: [Intel-wired-lan] [PATCH next v2 0/3] ethtool: Add ethtool_puts()

2023-10-30 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: [Intel-wired-lan] [PATCH next v2 2/3] checkpatch: add ethtool_sprintf rules

2023-10-30 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: [Intel-wired-lan] [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-30 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: [Intel-wired-lan] [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-30 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 >

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

2023-10-30 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 +

[Intel-wired-lan] [PATCH next v2 2/3] checkpatch: add ethtool_sprintf rules

2023-10-30 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

[Intel-wired-lan] [PATCH next v2 1/3] ethtool: Implement ethtool_puts()

2023-10-30 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

[Intel-wired-lan] [PATCH next v2 0/3] ethtool: Add ethtool_puts()

2023-10-30 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

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

2023-10-30 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

[Intel-wired-lan] [PATCH 3/3] checkpatch: add ethtool_sprintf rules

2023-10-30 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

[Intel-wired-lan] [PATCH 0/3] ethtool: Add ethtool_puts()

2023-10-30 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*\)"

[Intel-wired-lan] [PATCH 1/3] ethtool: Implement ethtool_puts()

2023-10-30 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

[Intel-wired-lan] [PATCH 2/3] treewide: Convert some ethtool_sprintf() to ethtool_puts()

2023-10-30 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

Re: [Intel-wired-lan] [PATCH net-next 0/7] net: intel: replace deprecated strncpy uses

2023-10-12 Thread Justin Stitt
On Tue, Oct 10, 2023 at 4:19 PM Jesse Brandeburg wrote: > > On 10/10/2023 3:26 PM, Justin Stitt wrote: > > Hi, > > > > This series aims to eliminate uses of strncpy() as it is a deprecated > > interface [1] with many viable replacements available. > > >

Re: [Intel-wired-lan] [PATCH] igc: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
On Tue, Oct 10, 2023 at 09:15:39PM +, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We expect netdev->name to be NUL-terminated based on i

Re: [Intel-wired-lan] [PATCH] igbvf: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
On Tue, Oct 10, 2023 at 09:12:00PM +, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We expect netdev->name to be NUL-terminated based

Re: [Intel-wired-lan] [PATCH] igb: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
On Tue, Oct 10, 2023 at 09:07:59PM +, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We see that netdev->name is expected to be NUL-termi

Re: [Intel-wired-lan] [PATCH] i40e: use scnprintf over strncpy+strncat

2023-10-12 Thread Justin Stitt
On Tue, Oct 10, 2023 at 08:53:00PM +, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > Moreover, `strncat` shouldn't really be used eit

Re: [Intel-wired-lan] [PATCH] fm10k: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
On Tue, Oct 10, 2023 at 07:53:32PM +, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > A suitable replacement is `strscpy` [2] due to t

Re: [Intel-wired-lan] [PATCH] e1000: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
On Tue, Oct 10, 2023 at 06:35:59PM +, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We can see that netdev->name is expected to be NUL-t

Re: [Intel-wired-lan] [PATCH] e100: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
On Mon, Oct 09, 2023 at 11:41:01PM +, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > The "...-1" pattern makes it evident that netde

[Intel-wired-lan] [PATCH v1 net-next 7/7] igc: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
n buffer without unnecessarily NUL-padding. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@v

[Intel-wired-lan] [PATCH v1 net-next 6/7] igbvf: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
g. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justi

[Intel-wired-lan] [PATCH v1 net-next 5/7] igb: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
rily NUL-padding. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-

[Intel-wired-lan] [PATCH v1 net-next 4/7] i40e: use scnprintf over strncpy+strncat

2023-10-12 Thread Justin Stitt
. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt

[Intel-wired-lan] [PATCH v1 net-next 3/7] fm10k: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only. --- drivers/net/ethernet/intel/fm10k

[Intel-wired-lan] [PATCH v1 net-next 2/7] e1000: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
tml/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only. ---

[Intel-wired-lan] [PATCH v1 net-next 1/7] e100: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt ---

[Intel-wired-lan] [PATCH net-next 0/7] net: intel: replace deprecated strncpy uses

2023-10-12 Thread Justin Stitt
/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Signed-off-by: Justin Stitt --- Justin Stitt (7): e100: replace deprecated strncpy with strs

Re: [Intel-wired-lan] [PATCH] igbvf: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
On Tue, Oct 10, 2023 at 2:20 PM Jesse Brandeburg wrote: > > On 10/10/2023 2:12 PM, Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings > > [1] and as such we should prefer more robust and less ambiguous string > > interfaces.

Re: [Intel-wired-lan] [PATCH] igc: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
On Tue, Oct 10, 2023 at 2:22 PM Jesse Brandeburg wrote: > > On 10/10/2023 2:15 PM, Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings > > [1] and as such we should prefer more robust and less ambiguous string > > interfaces.

[Intel-wired-lan] [PATCH] igc: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
s.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only. --- drivers/net/ethernet/intel/igc/igc_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(

[Intel-wired-lan] [PATCH] igbvf: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
g. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Just

[Intel-wired-lan] [PATCH] igb: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
rily NUL-padding. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed

[Intel-wired-lan] [PATCH] i40e: use scnprintf over strncpy+strncat

2023-10-12 Thread Justin Stitt
. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt

[Intel-wired-lan] [PATCH] fm10k: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only. --- drivers/net/ethernet/intel/fm10k

[Intel-wired-lan] [PATCH] e1000: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
tml/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt --- Note: build-tested only. ---

[Intel-wired-lan] [PATCH] e100: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-harden...@vger.kernel.org Signed-off-by: Justin Stitt ---