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
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
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
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
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
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
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
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
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
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
: 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
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
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
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
With Best Regards,
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
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
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
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
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
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
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
: 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
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
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
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
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
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)
> &
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
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
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
> > >
"No", "YES"/"NO" and all possible
variations of that.
--
With Best Regards,
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
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
ing it!
Reviewed-by: Andy Shevchenko
--
With Best Regards,
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
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
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:
> >
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:
> >>&
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
. Any suggestions,
plans, comments on how to address them?
[1]: https://paste.debian.net/hidden/46106f2a/
--
With Best Regards,
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
Best Regards,
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
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
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
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
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
0]) * (mk->mp->num + 1),
>GFP_KERNEL);
Convert this to use krealloc_array().
> if (!new_attrs)
> return -ENOMEM;
--
With Best Regards,
Andy Shevchenko
a single patch. There is no need to split these.
--
With Best Regards,
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
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
> > >
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
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
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
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) {
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'
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
> >
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
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
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
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:
> > &
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:
> >
> > [...]
> &
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
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
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
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
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
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
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
to me, thanks for doing this!
Reviewed-by: Andy Shevchenko
--
With Best Regards,
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
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
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
"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
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
> >
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
g when we need to dump the expected and resulting data). And
please Cc Rasmus as well.
--
With Best Regards,
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
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
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
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
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.
> &
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
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
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
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
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);
> > +
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
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
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
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
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
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
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-
)
- 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:
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
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
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
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 - 100 of 149 matches
Mail list logo