Re: [PATCH v1 4/7] gpio: 74x164: Make use of the macros from bits.h

2025-02-10 Thread Andy Shevchenko
On Mon, Feb 10, 2025 at 10:12:52AM +0100, Linus Walleij wrote: > On Mon, Feb 3, 2025 at 1:18 PM Andy Shevchenko > wrote: > > > Make use of BIT() and GENMASK() where it makes sense. > > > > Signed-off-by: Andy Shevchenko > > Reviewed-by: Linus Walleij

Re: [PATCH v2 7/7] gpio: 74x164: Utilise temporary variable for struct device

2025-02-10 Thread Andy Shevchenko
On Fri, Feb 07, 2025 at 08:56:45PM +0100, Bartosz Golaszewski wrote: > On Fri, Feb 7, 2025 at 4:42 PM Andy Shevchenko > wrote: > > > > On Fri, Feb 07, 2025 at 05:17:14PM +0200, Andy Shevchenko wrote: > > > We have a temporary variable to keep a pointer to struct device

Re: [PATCH v2 7/7] gpio: 74x164: Utilise temporary variable for struct device

2025-02-07 Thread Andy Shevchenko
On Fri, Feb 07, 2025 at 05:17:14PM +0200, Andy Shevchenko wrote: > We have a temporary variable to keep a pointer to struct device. > Utilise it where it makes sense. Urgh, this seems incomplete... There are more lines to convert, however they do not affect ± statistics. Tell me if I n

[PATCH v2 0/7] gpio: 74x164: Refactor and clean up the driver

2025-02-07 Thread Andy Shevchenko
Seems like I have had a cleanup series for 74x164, but forgot to send it last year, here it is. Changelog v2: - remove ->remove() leftover (Bart) - collected tags (Geert, Gustavo) Andy Shevchenko (7): gpio: 74x164: Remove unneeded dependency to OF_GPIO gpio: 74x164: Simplify code w

[PATCH v2 6/7] gpio: 74x164: Switch to use dev_err_probe()

2025-02-07 Thread Andy Shevchenko
Switch to use dev_err_probe() to simplify the error path and unify a message template. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index

[PATCH v2 5/7] gpio: 74x164: Fully convert to use managed resources

2025-02-07 Thread Andy Shevchenko
Convert the driver probe stage to use managed resources. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 27 --- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index 0f720d539fa7

[PATCH v2 1/7] gpio: 74x164: Remove unneeded dependency to OF_GPIO

2025-02-07 Thread Andy Shevchenko
Remove unneeded dependency to OF_GPIO which driver does not use. Fixes: 3c7469514dbe ("gpio: 74x164: Make use of device properties") Reviewed-by: Geert Uytterhoeven Signed-off-by: Andy Shevchenko --- drivers/gpio/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpio

[PATCH v2 7/7] gpio: 74x164: Utilise temporary variable for struct device

2025-02-07 Thread Andy Shevchenko
We have a temporary variable to keep a pointer to struct device. Utilise it where it makes sense. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c

[PATCH v2 4/7] gpio: 74x164: Make use of the macros from bits.h

2025-02-07 Thread Andy Shevchenko
Make use of BIT() and GENMASK() where it makes sense. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index 7844f8a58834..0f720d539fa7 100644 --- a

[PATCH v2 2/7] gpio: 74x164: Simplify code with cleanup helpers

2025-02-07 Thread Andy Shevchenko
Use macros defined in linux/cleanup.h to automate resource lifetime control in the driver. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c

[PATCH v2 3/7] gpio: 74x164: Annotate buffer with __counted_by()

2025-02-07 Thread Andy Shevchenko
: Gustavo A. R. Silva Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index 70c662bbca7b..7844f8a58834 100644 --- a/drivers/gpio/gpio-74x164.c +++ b

Re: [PATCH 06/10] x86/tdx: Mark message.str as nonstring

2025-02-07 Thread Andy Shevchenko
hen annotate it as not a string. > > Yeah, this is true all over the place. It's a string, just not a > NUL-terminated string: *sob* Maybe call it respectively, e.g., __nontermstr ? -- With Best Regards, Andy Shevchenko

Re: [PATCH 0/3] string.h: Use ARRAY_SIZE() for memtostr*()/strtomem*()

2025-02-06 Thread Andy Shevchenko
On Thu, Feb 06, 2025 at 10:52:18AM -0800, Kees Cook wrote: > On Thu, Feb 06, 2025 at 08:45:41PM +0200, Andy Shevchenko wrote: > > On Thu, Feb 6, 2025 at 8:44 PM Miguel Ojeda > > wrote: > > > On Thu, Feb 6, 2025 at 7:42 PM Andy Shevchenko > > > wrote: > &g

Re: [PATCH 0/3] string.h: Use ARRAY_SIZE() for memtostr*()/strtomem*()

2025-02-06 Thread Andy Shevchenko
On Thu, Feb 6, 2025 at 8:44 PM Miguel Ojeda wrote: > > On Thu, Feb 6, 2025 at 7:42 PM Andy Shevchenko > wrote: > > > > What's the minimum Clang version we build kernel with? 12? > > 13.0.1 for most architectures according to `scripts/min-tool-version.sh`. Okay, d

Re: [PATCH 0/3] string.h: Use ARRAY_SIZE() for memtostr*()/strtomem*()

2025-02-06 Thread Andy Shevchenko
With Best Regards, Andy Shevchenko

[PATCH v1 1/7] gpio: 74x164: Remove unneeded dependency to OF_GPIO

2025-02-03 Thread Andy Shevchenko
Remove unneeded dependency to OF_GPIO which driver does not use. Fixes: 3c7469514dbe ("gpio: 74x164: Make use of device properties") Signed-off-by: Andy Shevchenko --- drivers/gpio/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kco

[PATCH v1 6/7] gpio: 74x164: Switch to use dev_err_probe()

2025-02-03 Thread Andy Shevchenko
Switch to use dev_err_probe() to simplify the error path and unify a message template. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index

[PATCH v1 5/7] gpio: 74x164: Fully convert to use managed resources

2025-02-03 Thread Andy Shevchenko
Convert the driver probe stage to use managed resources. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index 0f720d539fa7

[PATCH v1 4/7] gpio: 74x164: Make use of the macros from bits.h

2025-02-03 Thread Andy Shevchenko
Make use of BIT() and GENMASK() where it makes sense. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index 7844f8a58834..0f720d539fa7 100644 --- a

[PATCH v1 7/7] gpio: 74x164: Utilise temporary variable for struct device

2025-02-03 Thread Andy Shevchenko
We have a temporary variable to keep a pointer to struct device. Utilise it where it makes sense. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c

[PATCH v1 2/7] gpio: 74x164: Simplify code with cleanup helpers

2025-02-03 Thread Andy Shevchenko
Use macros defined in linux/cleanup.h to automate resource lifetime control in the driver. Signed-off-by: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c

[PATCH v1 0/7] gpio: 74x164: Refactor and clean up the driver

2025-02-03 Thread Andy Shevchenko
Seems like I have had a cleanup series for 74x164, but forgot to send it last year, here it is. Andy Shevchenko (7): gpio: 74x164: Remove unneeded dependency to OF_GPIO gpio: 74x164: Simplify code with cleanup helpers gpio: 74x164: Annotate buffer with __counted_by() gpio: 74x164: Make

[PATCH v1 3/7] gpio: 74x164: Annotate buffer with __counted_by()

2025-02-03 Thread Andy Shevchenko
: Andy Shevchenko --- drivers/gpio/gpio-74x164.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index 70c662bbca7b..7844f8a58834 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c @@ -30,7

Re: [DISCUSSION] vsprintf: the current state of restricted pointers (%pK)

2025-01-14 Thread Andy Shevchenko
e read > by > userspace from e.g. procfs or sysfs, not for dmesg. Please refer to the > section about %p above for discussion about how to manage hashing > pointers > in printk(). > [3] Documentation/admin-guide/sysctl/kernel.rst: > "The correct long-term solution is to do the permission checks at > open() time." > [4] https://lore.kernel.org/lkml/20241217142032.55793-1-acarm...@redhat.com/ -- With Best Regards, Andy Shevchenko

Re: [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order

2025-01-13 Thread Andy Shevchenko
On Tue, Nov 19, 2024 at 07:47:17AM +0530, R Sundar wrote: > This patch series rearrange misplaced functions in sorted order and add > str_locked_unlocked() helper. Kees, anything preventing us to apply the first patch from the series? -- With Best Regards, Andy Shevchenko

Re: [PATCH v2 linux-next 0/2] lib/string_choices: Sorting function order

2024-11-19 Thread Andy Shevchenko
On Tue, Nov 19, 2024 at 4:17 AM R Sundar wrote: > > This patch series rearrange misplaced functions in sorted order and add > str_locked_unlocked() helper. LGTM, Reviewed-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko

Re: [PATCH linux-next] lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper

2024-11-17 Thread Andy Shevchenko
On Sat, Nov 16, 2024 at 5:48 AM R Sundar wrote: > On 16/11/24 01:16, Andy Shevchenko wrote: > > On Fri, Nov 15, 2024 at 9:44 PM Andy Shevchenko > > wrote: > >> On Fri, Nov 15, 2024 at 4:47 PM R Sundar wrote: ... > >>> +static inline co

Re: [PATCH linux-next] lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper

2024-11-15 Thread Andy Shevchenko
On Fri, Nov 15, 2024 at 9:44 PM Andy Shevchenko wrote: > On Fri, Nov 15, 2024 at 4:47 PM R Sundar wrote: ... > > --- a/include/linux/string_choices.h > > +++ b/include/linux/string_choices.h > > @@ -82,4 +82,10 @@ static inline const char *str_plural(size_t num) > &

Re: [PATCH linux-next] lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper

2024-11-15 Thread Andy Shevchenko
str_unlocked_locked(v) str_locked_unlocked(!(v)) The rest is sorted (okay, read_write() seems to be misplaced, fix that in a separate change if you wish), please keep it that way (I believe it should go before on_off). -- With Best Regards, Andy Shevchenko

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

2024-11-01 Thread Andy Shevchenko
ting the size for the > reallocation. > > Use krealloc_array() for the additional NULL terminator. What is / was the resolution on this change? It seems it either fell in cracks or being abandoned. -- With Best Regards, Andy Shevchenko

Re: [PATCH] coccinelle: Add str_off_on() and str_no_yes() rules

2024-10-27 Thread Andy Shevchenko
On Sun, Oct 27, 2024 at 5:25 PM Julia Lawall wrote: > On Sun, 27 Oct 2024, Andy Shevchenko wrote: > > On Sun, Oct 27, 2024 at 2:59 PM Thorsten Blum > > wrote: > > > > > > In addition to str_on_off() and str_yes_no(), add rules to search for > > >

Re: [PATCH] coccinelle: Add str_off_on() and str_no_yes() rules

2024-10-27 Thread Andy Shevchenko
"No", "YES"/"NO" and all possible variations of that. -- With Best Regards, Andy Shevchenko

Re: [PATCH] lib: string_helpers: fix potential snprintf() output truncation

2024-10-22 Thread Andy Shevchenko
s, do we have some common way to suppress them? I already pointed out these kinds of warnings from GCC. https://lore.kernel.org/all/zt73a3t8y8uh5...@smile.fi.intel.com/ -- With Best Regards, Andy Shevchenko

Re: [PATCH] lib: string_helpers: fix potential snprintf() output truncation

2024-10-22 Thread Andy Shevchenko
now which compiler gets it fixed, but now we have a problem with building with `make W=1` for the default configurations (it prevents build due to compilation errors), so this change is definitely is an improvement. -- With Best Regards, Andy Shevchenko

Re: [PATCH] lib: string_helpers: fix potential snprintf() output truncation

2024-10-21 Thread Andy Shevchenko
ing it! Reviewed-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko

Re: [PATCH] printf: Remove unused 'bprintf'

2024-10-02 Thread Andy Shevchenko
On Wed, Oct 02, 2024 at 02:31:19PM +, Dr. David Alan Gilbert wrote: > * Andy Shevchenko (a...@kernel.org) wrote: > > On Wed, Oct 02, 2024 at 02:21:25AM +0100, li...@treblig.org wrote: > > > From: "Dr. David Alan Gilbert" > > > > > > bprintf is

Re: [PATCH] printf: Remove unused 'bprintf'

2024-10-02 Thread Andy Shevchenko
with the amended commit message Reviewed-by: Andy Shevchenko P.S. I hope we may rely in CIs to report issues soon, if any. -- With Best Regards, Andy Shevchenko

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

2024-09-13 Thread Andy Shevchenko
On Fri, Sep 13, 2024 at 10:09:25PM +0300, Andy Shevchenko wrote: > On Fri, Sep 13, 2024 at 09:03:06PM +0200, Thorsten Blum wrote: > > On 13. Sep 2024, at 20:40, Andy Shevchenko > > wrote: > > > On Fri, Sep 13, 2024 at 09:46:30AM -0700, Nathan Chancellor wrote: > >

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

2024-09-13 Thread Andy Shevchenko
On Fri, Sep 13, 2024 at 09:03:06PM +0200, Thorsten Blum wrote: > On 13. Sep 2024, at 20:40, Andy Shevchenko > wrote: > > On Fri, Sep 13, 2024 at 09:46:30AM -0700, Nathan Chancellor wrote: > >> On Mon, Sep 09, 2024 at 06:27:26PM +0200, Thorsten Blum wrote: > >>&

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

2024-09-13 Thread Andy Shevchenko
an move us */ > > for (i = 0; i < mk->mp->num; i++) Shouldn't this for loop and followed by assignment also be -1:ed? -- With Best Regards, Andy Shevchenko

-Wformat-trunctation with `make W=1`

2024-09-09 Thread Andy Shevchenko
. Any suggestions, plans, comments on how to address them? [1]: https://paste.debian.net/hidden/46106f2a/ -- With Best Regards, Andy Shevchenko

Re: [PATCH -next v2 0/2] Introduce several opposite string choice helpers

2024-09-05 Thread Andy Shevchenko
t; > There are more than 10 cases currently (expect > str_disable_enable now has 3 use cases) exist in the code > can be replaced with these helper. Acked-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko

Re: [PATCH -next 0/2] coccinelle: Add rules to find str_true_false/str_false_true replacements

2024-09-04 Thread Andy Shevchenko
Best Regards, Andy Shevchenko

Re: [PATCH V9 2/2] iio: proximity: aw96103: Add support for aw96103/aw96105 proximity sensor

2024-09-03 Thread Andy Shevchenko
*/ + return regmap_read_poll_timeout(aw96103->regmap, AW96103_REG_IRQSRC, + reg_data, + FIELD_GET(AW96103_INITOVERIRQ_MASK, reg_data), + 1000, 2); } static int aw96103_read_chipid(struct aw96103 *aw96103) -- With Best Regards, Andy Shevchenko

Re: [PATCH -next 2/4] tun: Make use of str_disabled_enabled helper

2024-09-03 Thread Andy Shevchenko
On Tue, Sep 03, 2024 at 02:25:53PM +0800, Hongbo Li wrote: > On 2024/9/2 22:30, Willem de Bruijn wrote: > > Andy Shevchenko wrote: > > > On Sat, Aug 31, 2024 at 01:07:41PM -0700, Jakub Kicinski wrote: > > > > On Sat, 31 Aug 2024

Re: [PATCH -next 2/4] tun: Make use of str_disabled_enabled helper

2024-09-02 Thread Andy Shevchenko
you sent Side opinion: This makes the messages more unified and not prone to typos and/or grammatical mistakes. Unification allows to shrink binary due to linker efforts on string literals deduplication. That said, I see an improvement here, however it might be not recognised as a Big Win. And yes, I agree on the commit message poor explanations. -- With Best Regards, Andy Shevchenko

Re: [PATCH -next v3 1/3] lib/string_choices: Add str_true_false()/str_false_true() helper

2024-08-28 Thread Andy Shevchenko
27;t change anything. The function is inline and in the same compilation module the linker will optimise away the duplicates (note as well that this is kinda new feature, some relatively old GCC might not have this feature, but I'm not an expert in the area). -- With Best Regards, Andy Shevchenko

Re: [PATCH -next 0/2] Add str_true_false()/str_false_true() helper

2024-08-23 Thread Andy Shevchenko
On Fri, Aug 23, 2024 at 09:38:39PM +0800, Greg KH wrote: > On Fri, Aug 23, 2024 at 04:22:32PM +0300, Andy Shevchenko wrote: > > On Fri, Aug 23, 2024 at 9:13 AM Hongbo Li wrote: > > > > > > Add str_true_false()/str_false_true() helper to "true" or "fals

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

2024-08-23 Thread Andy Shevchenko
0]) * (mk->mp->num + 1), >GFP_KERNEL); Convert this to use krealloc_array(). > if (!new_attrs) > return -ENOMEM; -- With Best Regards, Andy Shevchenko

Re: [PATCH -next 0/2] Add str_true_false()/str_false_true() helper

2024-08-23 Thread Andy Shevchenko
a single patch. There is no need to split these. -- With Best Regards, Andy Shevchenko

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

2024-08-22 Thread Andy Shevchenko
t; drivers/net/wireless/marvell/mwifiex/scan.c:2239 > mwifiex_cmd_802_11_scan_ext+0x83/0x90 [mwifiex] Reviewed-by: Andy Shevchenko Thank you! -- With Best Regards, Andy Shevchenko

Re: [PATCH][next] wifi: mwifiex: Replace one-element arrays with flexible-array members

2024-08-21 Thread Andy Shevchenko
On Wed, Aug 21, 2024 at 02:59:34PM -0600, Gustavo A. R. Silva wrote: > On 21/08/24 14:26, Andy Shevchenko wrote: > > On Thu, Feb 02, 2023 at 07:32:00PM -0600, Gustavo A. R. Silva wrote: > > > One-element arrays are deprecated, and we are replacing them with flexible > > >

Re: [PATCH][next] wifi: mwifiex: Replace one-element arrays with flexible-array members

2024-08-21 Thread Andy Shevchenko
vers/net/wireless/marvell/mwifiex/scan.c:2239 mwifiex_cmd_802_11_scan_ext+0x83/0x90 [mwifiex] which leads to memcpy(ext_scan->tlv_buffer, scan_cfg->tlv_buf, scan_cfg->tlv_buf_len); but the code allocates 2k or more for the command buffer, so this seems quite enough for 243 bytes. -- With Best Regards, Andy Shevchenko

Re: [PATCH] coccinelle: Add rules to find str_down_up() replacements

2024-08-12 Thread Andy Shevchenko
On Mon, Aug 12, 2024 at 11:36:38AM -0700, Kees Cook wrote: > As done with str_up_down(), add checks for str_down_up() opportunities. > 5 cases currently exist in the tree. Reviewed-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko

Re: [PATCH] string_choices: Add wrapper for str_down_up()

2024-08-12 Thread Andy Shevchenko
On Mon, Aug 12, 2024 at 11:29:40AM -0700, Kees Cook wrote: > The string choice functions which are not clearly true/false synonyms > also have inverted wrappers. Add this for str_down_up() as well. Reviewed-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko

Re: [PATCH] lib/string_helpers: rework overflow-dependent code

2024-08-10 Thread Andy Shevchenko
On Sat, Aug 10, 2024 at 6:39 PM Andy Shevchenko wrote: > On Sat, Aug 10, 2024 at 2:53 AM Justin Stitt wrote: > > On Fri, Aug 09, 2024 at 02:07:57PM GMT, Andy Shevchenko wrote: ... > > But, we could do this too: > > - while (*src && --size) {

Re: [PATCH] lib/string_helpers: rework overflow-dependent code

2024-08-10 Thread Andy Shevchenko
On Sat, Aug 10, 2024 at 2:53 AM Justin Stitt wrote: > On Fri, Aug 09, 2024 at 02:07:57PM GMT, Andy Shevchenko wrote: > > On Fri, Aug 9, 2024 at 2:11 AM Kees Cook wrote: ... > > Okay, but the patch has an off-by-one error (which has no impact on > > the behavior as it'

Re: [PATCH] lib/string_helpers: rework overflow-dependent code

2024-08-09 Thread Andy Shevchenko
On Fri, Aug 9, 2024 at 2:11 AM Kees Cook wrote: > > On Fri, Aug 09, 2024 at 01:07:21AM +0300, Andy Shevchenko wrote: > > On Fri, Aug 9, 2024 at 12:44 AM Justin Stitt wrote: > > > > > > When @size is 0, the desired behavior is to allow unlimited bytes to be > >

Re: [PATCH] lib/string_helpers: rework overflow-dependent code

2024-08-08 Thread Andy Shevchenko
e desired behavior without relying on intentional > overflow/underflow. Hmm... but why? Overflow for the _unsigned_ types is okay. No? -- With Best Regards, Andy Shevchenko

Re: [PATCH 2/2] coccinelle: Add rules to find str_up_down() replacements

2024-08-08 Thread Andy Shevchenko
On Thu, Jul 25, 2024 at 12:18:41PM +0200, Michal Wajdeczko wrote: > Add rules for finding places where str_up_down() can be used. > This currently finds over 20 locations. This would be need an update as well in accordance with the review comment on patch 1. -- With Best Regards

Re: [PATCH 1/2] lib/string_choices: Add str_up_down() helper

2024-08-08 Thread Andy Shevchenko
please add a respective macro for str_down_up() as it's done for (some) others? P.S. Yes, I see these two has been applied, so perhaps followup? -- With Best Regards, Andy Shevchenko

Re: [PATCH] mm/util: Swap kmemdup_array() arguments

2024-06-06 Thread Andy Shevchenko
On Thu, Jun 06, 2024 at 11:10:43AM -0700, Kees Cook wrote: > On Thu, Jun 06, 2024 at 08:48:37PM +0300, Andy Shevchenko wrote: > > On Thu, Jun 6, 2024 at 8:46 PM Kees Cook wrote: > > > > > > On Thu, Jun 06, 2024 at 08:35:13PM +0300, Andy Shevchenko wrote: > > &

Re: [PATCH] mm/util: Swap kmemdup_array() arguments

2024-06-06 Thread Andy Shevchenko
On Thu, Jun 6, 2024 at 8:46 PM Kees Cook wrote: > > On Thu, Jun 06, 2024 at 08:35:13PM +0300, Andy Shevchenko wrote: > > On Thu, Jun 6, 2024 at 6:56 PM Kees Cook wrote: > > > On Thu, 06 Jun 2024 15:46:09 +0100, Jean-Philippe Brucker wrote: > > > > [...] > &

Re: [PATCH] mm/util: Swap kmemdup_array() arguments

2024-06-06 Thread Andy Shevchenko
On Thu, Jun 6, 2024 at 6:56 PM Kees Cook wrote: > On Thu, 06 Jun 2024 15:46:09 +0100, Jean-Philippe Brucker wrote: [...] > Applied to for-next/hardening, thanks! Btw, is it possible to get this for v6.10, so we may start enabling it for others? -- With Best Regards, Andy Shevchenko

Re: [PATCH] mm/util: Swap kmemdup_array() arguments

2024-06-06 Thread Andy Shevchenko
ealloc_array(), memdup_array_user(), calloc() etc. LGTM, it seems we don't have many users (yet), this looks like a comprehensive change. Reviewed-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko

Re: [PATCH] auxdisplay: Use sizeof(*pointer) instead of sizeof(type)

2024-06-03 Thread Andy Shevchenko
er (unlike the latter). This patch has no effect > > on runtime behavior. > > > > Signed-off-by: Erick Archer > > Reviewed-by: Geert Uytterhoeven Pushed to my review and testing queue, thanks! -- With Best Regards, Andy Shevchenko

Re: [PATCH 2/2] string: improve strlen performance

2024-05-02 Thread Andy Shevchenko
On Thu, May 02, 2024 at 08:10:32AM -0700, Kees Cook wrote: > On Thu, May 02, 2024 at 06:03:04PM +0300, Andy Shevchenko wrote: > > On Thu, May 2, 2024 at 5:59 PM Andy Shevchenko > > wrote: > > > On Thu, May 2, 2024 at 5:14 PM Hsin-Yu.Chen wrote: > > > > And

Re: [PATCH 2/2] string: improve strlen performance

2024-05-02 Thread Andy Shevchenko
On Thu, May 2, 2024 at 5:59 PM Andy Shevchenko wrote: > On Thu, May 2, 2024 at 5:14 PM Hsin-Yu.Chen wrote: And on top of that, check what this code will do on the architectures that do not support unaligned access. If everything is fine, mention this in the commit message. Btw, your com

Re: [PATCH 2/2] string: improve strlen performance

2024-05-02 Thread Andy Shevchenko
else if (cp[5] == 0) > + return cp - s + 5; > + else if (cp[6] == 0) > + return cp - s + 6; > + else if (cp[7] == 0) > + return cp - s + 7; A lot of redundant 'else':s. > + } > + } > + } -- With Best Regards, Andy Shevchenko

Re: [PATCH] string: Add additional __realloc_size() annotations for "dup" helpers

2024-05-02 Thread Andy Shevchenko
es not have the > ability to manipulate userspace memory.) Makes sense to me, Reviewed-by: Andy Shevchenko ... > + checker(len, kmemdup_array(test_phrases[idx], len, 1, \ > + gfp), kfree(p)); \ Despite being lo

Re: [PATCH 0/5] string: Merge separate tests into string_kunit.c

2024-04-19 Thread Andy Shevchenko
to me, thanks for doing this! Reviewed-by: Andy Shevchenko -- With Best Regards, Andy Shevchenko

Re: [PATCH v2] string_kunit: Add test cases for str*cmp functions

2024-04-18 Thread Andy Shevchenko
s aim at covering as many edge cases as possible, > including the tests on empty strings, situations when the different > symbol is placed at the end of one of the strings, etc. LGTM, Reviewed-by: Andy Shevchenko Thanks! -- With Best Regards, Andy Shevchenko

Re: [PATCH] string: Implement KUnit test for str*cmp functions

2024-04-17 Thread Andy Shevchenko
On Wed, Apr 17, 2024 at 03:46:44PM +0100, Ivan Orlov wrote: > On 4/17/24 15:28, Andy Shevchenko wrote: > > On Wed, Apr 17, 2024 at 02:54:15PM +0100, Ivan Orlov wrote: ... > > > lib/strcmp_kunit.c | 170 + > > > > W

Re: [PATCH] string: Implement KUnit test for str*cmp functions

2024-04-17 Thread Andy Shevchenko
ny edge cases as possible, including > the tests on empty strings, situations when the different symbol is > placed at the end of one of the strings, etc. ... > lib/strcmp_kunit.c | 170 + Why is not part of the existing string_kunit.c? -- With Best Regards, Andy Shevchenko

Re: [PATCH 1/5] string.h: Introduce memtostr() and memtostr_pad()

2024-04-09 Thread Andy Shevchenko
"name" may contain a 1 character early truncation of > p->name. > > Provide an unambiguous interface for converting a maybe not-NUL-terminated > string to a NUL-terminated string, with compile-time buffer size checking > so that it can never fail at runtime: memtostr() and memtostr_pad(). Also > add KUnit tests for both. Obvious question, why can't strscpy() be fixed for this corner case? -- With Best Regards, Andy Shevchenko

Re: [PATCH v2 1/2] string: Convert selftest to KUnit

2024-03-01 Thread Andy Shevchenko
On Fri, Mar 01, 2024 at 09:25:07AM -0800, Kees Cook wrote: > On Fri, Mar 01, 2024 at 01:09:27PM +0200, Andy Shevchenko wrote: > > On Fri, Mar 1, 2024 at 2:26 AM Kees Cook wrote: > > > > > > Convert test_string.c to KUnit so it can be easily run with everything > >

Re: [PATCH v1 1/1] lib/string_helpers: Add flags param to string_get_size()

2024-03-01 Thread Andy Shevchenko
On Thu, Feb 29, 2024 at 04:54:30PM -0500, Kent Overstreet wrote: > On Thu, Feb 29, 2024 at 01:52:34PM -0800, Kees Cook wrote: > > On Thu, 29 Feb 2024 22:52:30 +0200, Andy Shevchenko wrote: > > > The new flags parameter allows controlling > > > - Whether or not the uni

Re: [PATCH v2 0/2] string: Convert selftests to KUnit

2024-03-01 Thread Andy Shevchenko
g when we need to dump the expected and resulting data). And please Cc Rasmus as well. -- With Best Regards, Andy Shevchenko

Re: [PATCH v2 2/2] string: Convert helpers selftest to KUnit

2024-03-01 Thread Andy Shevchenko
t, len)) { > + result = memcmp(dst, strings_lower[i].out, len); > + KUNIT_EXPECT_EQ(test, 0, result); Ditto. > + if (result) > pr_warn("Test 'string_lower failed : : expected %s, > got %s!\n", > strings_lower[i].out, dst); > - kfree(dst); > - return; > - } > kfree(dst); > } > } -- With Best Regards, Andy Shevchenko

Re: [PATCH v2 1/2] string: Convert selftest to KUnit

2024-03-01 Thread Andy Shevchenko
ring, i); In a similar way, all returned values are *special*, you really need to think about them before converting to a simple (and sometimes wrong) checks) ... I dunno if KUnit has a fault ejection simulation. It should, in order to be sure that test cases are fine when they fail. -- With Best Regards, Andy Shevchenko

[PATCH v1 1/1] lib/string_helpers: Add flags param to string_get_size()

2024-02-29 Thread Andy Shevchenko
Suren Baghdasaryan Reviewed-by: Kees Cook Signed-off-by: Andy Shevchenko --- My vesrion of https://lore.kernel.org/r/20240212213922.783301-2-sur...@google.com Enjoy! include/linux/string_helpers.h | 10 -- lib/string_helpers.c | 29 --- lib/test-string_helpers.c

Re: [PATCH] sparc: vdso: Disable UBSAN instrumentation

2024-02-29 Thread Andy Shevchenko
applied patches, but these Cc seems to appear in a few commits in your hardening branch. I formatted patch from 9fd54b08040669, checked out the new branch just before this commit and run `git am 0001-...`. I don't see them. -- With Best Regards, Andy Shevchenko

Re: [PATCH v4 8/8] dmaengine: ste_dma40: Use new helpers from overflow.h

2024-02-29 Thread Andy Shevchenko
On Thu, Feb 29, 2024 at 03:14:03PM +0100, Linus Walleij wrote: > On Wed, Feb 28, 2024 at 9:49 PM Andy Shevchenko > wrote: > > > We have two new helpers struct_size_with_data() and struct_data_pointer() > > that we can utilize in d40_hw_detect_init(). Do it so. > &

Re: [PATCH v4 1/8] overflow: Use POD in check_shl_overflow()

2024-02-29 Thread Andy Shevchenko
On Wed, Feb 28, 2024 at 01:33:15PM -0800, Kees Cook wrote: > On Wed, Feb 28, 2024 at 10:41:31PM +0200, Andy Shevchenko wrote: > > The check_shl_overflow() uses u64 type that is defined in types.h. > > Instead of including that header, just switch to use POD type > > directly

Re: [PATCH v4 7/8] net-device: Use new helpers from overflow.h in netdevice APIs

2024-02-29 Thread Andy Shevchenko
LIGN); > }; > > And internals can use struct net_device_alloc... I just realized that I made same approach in f6d7f050e258 ("spi: Don't use flexible array in struct spi_message definition") 75e308ffc4f0 ("spi: Use struct_size() helper") -- With Best Regards, Andy Shevchenko

Re: [PATCH v4 7/8] net-device: Use new helpers from overflow.h in netdevice APIs

2024-02-28 Thread Andy Shevchenko
On Wed, Feb 28, 2024 at 01:46:10PM -0800, Kees Cook wrote: > On Wed, Feb 28, 2024 at 10:41:37PM +0200, Andy Shevchenko wrote: ... > > static inline void *netdev_priv(const struct net_device *dev) > > { > > - return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_A

Re: [PATCH v4 2/8] overflow: Add struct_size_with_data() and struct_data_pointer() helpers

2024-02-28 Thread Andy Shevchenko
On Wed, Feb 28, 2024 at 01:37:36PM -0800, Kees Cook wrote: > On Wed, Feb 28, 2024 at 10:41:32PM +0200, Andy Shevchenko wrote: ... > > +#define struct_data_pointer(p, a) PTR_ALIGN((void *)((p) + 1), (a)) > > I'm not super excited about propagating the "p + 1" code

Re: [PATCH v4 3/8] iio: core: NULLify private pointer when there is no private data

2024-02-28 Thread Andy Shevchenko
On Wed, Feb 28, 2024 at 03:06:42PM -0600, David Lechner wrote: > On Wed, Feb 28, 2024 at 2:50 PM Andy Shevchenko > wrote: ... > > - indio_dev->priv = (char *)iio_dev_opaque + > > - ALIGN(sizeof(struct iio_dev_opaque), IIO_DMA_MINALIGN); > > +

Re: [PATCH v4 4/8] iio: core: Calculate alloc_size only once in iio_device_alloc()

2024-02-28 Thread Andy Shevchenko
On Wed, Feb 28, 2024 at 02:57:36PM -0600, David Lechner wrote: > On Wed, Feb 28, 2024 at 2:49 PM Andy Shevchenko > wrote: ... > > - alloc_size = sizeof(struct iio_dev_opaque); > > - if (sizeof_priv) { > > - alloc_size = ALIGN(allo

[PATCH v4 5/8] iio: core: Use new helpers from overflow.h in iio_device_alloc()

2024-02-28 Thread Andy Shevchenko
We have two new helpers struct_size_with_data() and struct_data_pointer() that we can utilize in iio_device_alloc(). Do it so. Signed-off-by: Andy Shevchenko Reviewed-by: Nuno Sa --- drivers/iio/industrialio-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a

[PATCH v4 7/8] net-device: Use new helpers from overflow.h in netdevice APIs

2024-02-28 Thread Andy Shevchenko
We have two new helpers struct_size_with_data() and struct_data_pointer() that we can utilize in alloc_netdev_mqs() and netdev_priv(). Do it so. Signed-off-by: Andy Shevchenko --- include/linux/netdevice.h | 3 ++- net/core/dev.c| 10 +- 2 files changed, 7 insertions(+), 6

[PATCH v4 8/8] dmaengine: ste_dma40: Use new helpers from overflow.h

2024-02-28 Thread Andy Shevchenko
We have two new helpers struct_size_with_data() and struct_data_pointer() that we can utilize in d40_hw_detect_init(). Do it so. Signed-off-by: Andy Shevchenko --- drivers/dma/ste_dma40.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/dma/ste_dma40.c b

[PATCH v4 6/8] spi: Use new helpers from overflow.h in __spi_alloc_controller()

2024-02-28 Thread Andy Shevchenko
We have two new helpers struct_size_with_data() and struct_data_pointer() that we can utilize in __spi_alloc_controller(). Do it so. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi

[PATCH v4 1/8] overflow: Use POD in check_shl_overflow()

2024-02-28 Thread Andy Shevchenko
The check_shl_overflow() uses u64 type that is defined in types.h. Instead of including that header, just switch to use POD type directly. Signed-off-by: Andy Shevchenko --- include/linux/overflow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/overflow.h b

[PATCH v4 3/8] iio: core: NULLify private pointer when there is no private data

2024-02-28 Thread Andy Shevchenko
In iio_device_alloc() when size of the private data is 0, the private pointer is calculated to behind the valid data. NULLify it for good. Fixes: 6d4ebd565d15 ("iio: core: wrap IIO device into an iio_dev_opaque object") Signed-off-by: Andy Shevchenko --- drivers/iio/industrialio-

[PATCH v4 0/8] iio: core: New macros and making use of them

2024-02-28 Thread Andy Shevchenko
) - dropped wrong hunk for krealloc_array() conversion (Jonathan) - dropped initcall move (Jonathan) v2: - sprintf() --> sysfs_emit() (Nuno) - added tag (Nuno) Andy Shevchenko (8): overflow: Use POD in check_shl_overflow() overflow:

[PATCH v4 2/8] overflow: Add struct_size_with_data() and struct_data_pointer() helpers

2024-02-28 Thread Andy Shevchenko
Introduce two helper macros to calculate the size of the structure with trailing aligned data and to retrieve the pointer to that data. Signed-off-by: Andy Shevchenko --- include/linux/overflow.h | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a

[PATCH v4 4/8] iio: core: Calculate alloc_size only once in iio_device_alloc()

2024-02-28 Thread Andy Shevchenko
No need to rewrite the value, instead use 'else' branch. This will also help further refactoring the code later on. Signed-off-by: Andy Shevchenko --- drivers/iio/industrialio-core.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/iio/industriali

Re: [PATCH v2] iio: pressure: dlhl60d: Initialize empty DLH bytes

2024-02-23 Thread Andy Shevchenko
On Fri, Feb 23, 2024 at 07:47:36PM +0200, Andy Shevchenko wrote: > On Fri, Feb 23, 2024 at 09:29:39AM -0800, Kees Cook wrote: > > 3 bytes were being read but 4 were being written. Explicitly initialize > > the unused bytes to 0 and refactor the loop to use direct array > > in

Re: [PATCH v2] iio: pressure: dlhl60d: Initialize empty DLH bytes

2024-02-23 Thread Andy Shevchenko
amp;st->rx_buf[1] + chn * DLH_NUM_DATA_BYTES, > DLH_NUM_DATA_BYTES); > - i++; > } Not that I'm against the changes, but they (in accordance with the commit message) are irrelevant to this fix. I prefer fixes to be more focused on the real issues. -- With Best Regards, Andy Shevchenko

  1   2   >