Re: [PATCH -next v2 0/9] coccinelle: Add some rules for string_chioces helpers.

2024-09-09 Thread Hongbo Li
On 2024/9/4 17:14, Hongbo Li wrote: 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 help

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

2024-09-09 Thread Dmitry Antipov
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()"). Fixes: 807f8a8c3004 ("cfg80211/nl80211: add support for scheduled scans") Fixe

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

2024-09-09 Thread Kalle Valo
Dmitry Antipov writes: > 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()"). > > Fixes: 807f8a8c3004 ("cfg80211/nl80211: ad

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

2024-09-09 Thread Dmitry Antipov
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()"). Fixes: 807f8a8c3004 ("cfg80211/nl80211: add support for scheduled scans") Fixe

[PATCH] overflow: optimize struct_size() calculation

2024-09-09 Thread Vincent Mailhol
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: - there are padding bytes after the penultimate member (the member

Re: [PATCH][next] wifi: mwifiex: Fix memcpy() field-spanning write warning in mwifiex_cmd_802_11_scan_ext()

2024-09-09 Thread Kalle Valo
"Gustavo A. R. Silva" wrote: > Replace one-element array with a flexible-array member in > `struct host_cmd_ds_802_11_scan_ext`. > > With this, fix the following warning: > > elo 16 17:51:58 surfacebook kernel: [ cut here ] > elo 16 17:51:58 surfacebook kernel: memcpy: d

-Wformat-trunctation with `make W=1`

2024-09-09 Thread Andy Shevchenko
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 additional warnings that are mostly related to -Wformat-truncation [1]. Any s

Re: [PATCH -next v2 1/9] coccinelle: Add rules to find str_true_false() replacements

2024-09-09 Thread Julia Lawall
On Wed, 4 Sep 2024, Hongbo Li wrote: > 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

Re: [PATCH -next v2 0/9] coccinelle: Add some rules for string_chioces helpers.

2024-09-09 Thread Julia Lawall
On Wed, 4 Sep 2024, Hongbo Li wrote: > 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 c

RE: [PATCH] overflow: optimize struct_size() calculation

2024-09-09 Thread David Laight
From: Vincent Mailhol > Sent: 09 September 2024 12:52 > > 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: > >

[RESEND PATCH v2] params: Annotate struct module_param_attrs with __counted_by()

2024-09-09 Thread Thorsten Blum
Add the __counted_by compiler attribute to the flexible array member attrs to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Increment num before adding a new param_attribute to the attrs array and adjust the array index accordingly. Increment num immediately aft

[PATCH] caif: replace deprecated strncpy with strscpy_pad

2024-09-09 Thread Justin Stitt
eld); return 0; } --- base-commit: bc83b4d1f08695e85e85d36f7b803da58010161d change-id: 20240909-strncpy-net-caif-chnl_net-c-a505e955e697 Best regards, -- Justin Stitt

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

2024-09-09 Thread Vincent MAILHOL
On Tue. 10 Sept. 2024 at 01:19, David Laight wrote: > From: Vincent Mailhol > > Sent: 09 September 2024 12:52 > > > > 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

Re: [PATCH -next v2 1/9] coccinelle: Add rules to find str_true_false() replacements

2024-09-09 Thread Hongbo Li
On 2024/9/10 0:00, Julia Lawall wrote: On Wed, 4 Sep 2024, Hongbo Li wrote: 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/coc

Re: [PATCH -next v2 1/9] coccinelle: Add rules to find str_true_false() replacements

2024-09-09 Thread Hongbo Li
On 2024/9/10 10:23, Hongbo Li wrote: On 2024/9/10 0:00, Julia Lawall wrote: On Wed, 4 Sep 2024, Hongbo Li wrote: 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. Sig

[PATCH v2] overflow: optimize struct_size() calculation

2024-09-09 Thread Vincent Mailhol
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: - there are padding bytes after the penultimate member (the member