Re: [PATCH] caif: replace deprecated strncpy with strscpy_pad

2024-09-10 Thread Simon Horman
On Mon, Sep 09, 2024 at 04:39:28PM -0700, 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. > > Towards the goal of [2], replace strncpy() with an alternative that > guara

Re: [PATCH] Bluetooth: replace deprecated strncpy with strscpy_pad

2024-09-10 Thread patchwork-bot+bluetooth
Hello: This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz : On Thu, 05 Sep 2024 15:54:40 -0700 you wrote: > strncpy() is deprecated for use on NUL-terminated destination strings [0] > and as such we should prefer more robust and less ambiguous string interfa

Re: -Wformat-trunctation with `make W=1`

2024-09-10 Thread Kees Cook
On Mon, Sep 09, 2024 at 04:26:03PM +0300, Andy Shevchenko wrote: > Recently I'm trying to compile my (almost) x86_64_defconfig based kernel with > `make W=1` while having CONFIG_WERROR=y. With a handful of patches I was able > to achieve that with clang-18, however GCC 14.2.0 issues a lot of additi

Re: [PATCH v2] wifi: cfg80211: fix two more possible UBSAN-detected off-by-one errors

2024-09-10 Thread Kees Cook
On Mon, Sep 09, 2024 at 12:08:06PM +0300, Dmitry Antipov wrote: > Although not reproduced in practice, these two cases may be > considered by UBSAN as off-by-one errors. So fix them in the > same way as in commit a26a5107bc52 ("wifi: cfg80211: fix UBSAN > noise in cfg80211_wext_siwscan()"). > > Fi

Re: [PATCH v2] overflow: optimize struct_size() calculation

2024-09-10 Thread Kees Cook
On Tue, Sep 10, 2024 at 11:49:52AM +0900, Vincent Mailhol wrote: > If the offsetof() of a given flexible array member (fam) is smaller > than the sizeof() of the containing struct, then the struct_size() > macro reports a size which is too big. > > This occurs when the two conditions below are met

[PATCH -next v3 01/10] coccinelle: Add rules to find str_true_false() replacements

2024-09-10 Thread Hongbo Li
After str_true_false() has been introduced in the tree, we can add rules for finding places where str_true_false() can be used. A simple test can find over 10 locations. Signed-off-by: Hongbo Li --- scripts/coccinelle/api/string_choices.cocci | 19 +++ 1 file changed, 19 insertio

[PATCH -next v3 03/10] coccinelle: Add rules to find str_hi{gh}_lo{w}() replacements

2024-09-10 Thread Hongbo Li
As other rules done, we add rules for str_hi{gh}_lo{w}() to check the relative opportunities. Signed-off-by: Hongbo Li --- scripts/coccinelle/api/string_choices.cocci | 42 + 1 file changed, 42 insertions(+) diff --git a/scripts/coccinelle/api/string_choices.cocci b/scripts

[PATCH -next v3 06/10] coccinelle: Add rules to find str_read_write() replacements

2024-09-10 Thread Hongbo Li
As other rules done, we add rules for str_read_write() to check the relative opportunities. Signed-off-by: Hongbo Li --- scripts/coccinelle/api/string_choices.cocci | 19 +++ 1 file changed, 19 insertions(+) diff --git a/scripts/coccinelle/api/string_choices.cocci b/scripts/coc

[PATCH -next v3 05/10] coccinelle: Add rules to find str_enable{d}_disable{d}() replacements

2024-09-10 Thread Hongbo Li
As other rules done, we add rules for str_enable{d}_ disable{d}() to check the relative opportunities. Signed-off-by: Hongbo Li --- scripts/coccinelle/api/string_choices.cocci | 38 + 1 file changed, 38 insertions(+) diff --git a/scripts/coccinelle/api/string_choices.cocci

[PATCH -next v3 02/10] coccinelle: Add rules to find str_false_true() replacements

2024-09-10 Thread Hongbo Li
As done with str_true_false(), add checks for str_false_true() opportunities. A simple test can find over 9 cases currently exist in the tree. Signed-off-by: Hongbo Li --- scripts/coccinelle/api/string_choices.cocci | 19 +++ 1 file changed, 19 insertions(+) diff --git a/scripts

[PATCH -next v3 08/10] coccinelle: Add rules to find str_on_off() replacements

2024-09-10 Thread Hongbo Li
As other rules done, we add rules for str_on_off() to check the relative opportunities. Signed-off-by: Hongbo Li --- scripts/coccinelle/api/string_choices.cocci | 19 +++ 1 file changed, 19 insertions(+) diff --git a/scripts/coccinelle/api/string_choices.cocci b/scripts/coccine

[PATCH -next v3 04/10] coccinelle: Add rules to find str_lo{w}_hi{gh}() replacements

2024-09-10 Thread Hongbo Li
As other rules done, we add rules for str_lo{w}_hi{gh}() to check the relative opportunities. Signed-off-by: Hongbo Li --- scripts/coccinelle/api/string_choices.cocci | 38 + 1 file changed, 38 insertions(+) diff --git a/scripts/coccinelle/api/string_choices.cocci b/scripts

[PATCH -next v3 00/10] coccinelle: Add some rules for string_chioces helpers.

2024-09-10 Thread Hongbo Li
We found that many of the detection rules for helpers in string_choices.h are missing. This series of patches is intended to complete these rules. We have verified in the latest kernel tree that these rules can detect many places where the string choices helper can be used as a replacement. Here a

[PATCH -next v3 07/10] coccinelle: Add rules to find str_write_read() replacements

2024-09-10 Thread Hongbo Li
As other rules done, we add rules for str_write_read() to check the relative opportunities. Signed-off-by: Hongbo Li --- scripts/coccinelle/api/string_choices.cocci | 19 +++ 1 file changed, 19 insertions(+) diff --git a/scripts/coccinelle/api/string_choices.cocci b/scripts/coc

[PATCH -next v3 09/10] coccinelle: Add rules to find str_yes_no() replacements

2024-09-10 Thread Hongbo Li
As other rules done, we add rules for str_yes_no() to check the relative opportunities. Signed-off-by: Hongbo Li --- scripts/coccinelle/api/string_choices.cocci | 19 +++ 1 file changed, 19 insertions(+) diff --git a/scripts/coccinelle/api/string_choices.cocci b/scripts/coccine

[PATCH -next v3 10/10] coccinelle: Remove unnecessary parentheses for only one possible change.

2024-09-10 Thread Hongbo Li
The parentheses are only needed if there is a disjunction, ie a set of possible changes. If there is only one pattern, we can remove these parentheses. Just like the format: - x + y not: ( - x + y ) Signed-off-by: Hongbo Li --- scripts/coccinelle/api/string_choices.cocci | 8 -

Re: [PATCH v2] overflow: optimize struct_size() calculation

2024-09-10 Thread Vincent MAILHOL
On Wed. 11 Sep. 2024 at 09:36, Kees Cook wrote: > On Tue, Sep 10, 2024 at 11:49:52AM +0900, Vincent Mailhol wrote: > > If the offsetof() of a given flexible array member (fam) is smaller > > than the sizeof() of the containing struct, then the struct_size() > > macro reports a size which is too bi