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
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 +
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
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
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
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 +
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
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
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
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
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
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
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:
> >
> &
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(
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
>
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 +
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
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
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
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
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
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*\)"
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
-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
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.
> >
>
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
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
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
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
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
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
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
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
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
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-
.
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
#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
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.
---
:
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
---
/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
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.
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.
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(
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
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
.
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
#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
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.
---
:
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
---
49 matches
Mail list logo