Re: [PATCH v5 0/7] treewide cleanup of random integer usage

2022-10-08 Thread Kees Cook
On Fri, Oct 07, 2022 at 11:53:52PM -0600, Jason A. Donenfeld wrote: > This is a five part treewide cleanup of random integer handling. The > rules for random integers are: Reviewing the delta between of my .cocci rules and your v5, everything matches, except for get_random_int() conversions for

Re: [PATCH v3 3/5] treewide: use get_random_u32() when possible

2022-10-08 Thread Jason A. Donenfeld
On Sat, Oct 08, 2022 at 09:53:33PM +, David Laight wrote: > From: Jason A. Donenfeld > > Sent: 07 October 2022 18:56 > ... > > > Given these kinds of less mechanical changes, it may make sense to split > > > these from the "trivial" conversions in a treewide patch. The chance of > > > needing

Re: [PATCH v4 4/6] treewide: use get_random_u32() when possible

2022-10-08 Thread Jason A. Donenfeld
On Sat, Oct 8, 2022 at 4:37 PM Jason A. Donenfeld wrote: > > On Sat, Oct 08, 2022 at 10:18:45PM +, David Laight wrote: > > From: Jason A. Donenfeld > > > Sent: 07 October 2022 19:01 > > > > > > The prandom_u32() function has been a deprecated inline wrapper around > > > get_random_u32() for

[powerpc:next] BUILD SUCCESS 376b3275c19f83d373e841e9af2d7658693190b9

2022-10-08 Thread kernel test robot
randconfig-r043-20221008 powerpc ep8248e_defconfig arm badge4_defconfig sh r7780mp_defconfig arc randconfig-r043-20221003 mips db1xxx_defconfig arcvdk_hs38_defconfig alpha

Re: [PATCH v4 4/6] treewide: use get_random_u32() when possible

2022-10-08 Thread Jason A. Donenfeld
On Sat, Oct 08, 2022 at 10:18:45PM +, David Laight wrote: > From: Jason A. Donenfeld > > Sent: 07 October 2022 19:01 > > > > The prandom_u32() function has been a deprecated inline wrapper around > > get_random_u32() for several releases now, and compiles down to the > > exact same code.

Re: [PATCH v4 2/6] treewide: use prandom_u32_max() when possible

2022-10-08 Thread Jason A. Donenfeld
On Sat, Oct 08, 2022 at 10:08:03PM +, David Laight wrote: > From: Jason A. Donenfeld > > Sent: 07 October 2022 19:01 > > > > Rather than incurring a division or requesting too many random bytes for > > the given range, use the prandom_u32_max() function, which only takes > > the minimum

RE: [PATCH v4 4/6] treewide: use get_random_u32() when possible

2022-10-08 Thread David Laight
From: Jason A. Donenfeld > Sent: 07 October 2022 19:01 > > The prandom_u32() function has been a deprecated inline wrapper around > get_random_u32() for several releases now, and compiles down to the > exact same code. Replace the deprecated wrapper with a direct call to > the real function. The

RE: [PATCH v4 2/6] treewide: use prandom_u32_max() when possible

2022-10-08 Thread David Laight
From: Jason A. Donenfeld > Sent: 07 October 2022 19:01 > > Rather than incurring a division or requesting too many random bytes for > the given range, use the prandom_u32_max() function, which only takes > the minimum required bytes from the RNG and avoids divisions. > ... > ---

RE: [PATCH v3 3/5] treewide: use get_random_u32() when possible

2022-10-08 Thread David Laight
From: Jason A. Donenfeld > Sent: 07 October 2022 18:56 ... > > Given these kinds of less mechanical changes, it may make sense to split > > these from the "trivial" conversions in a treewide patch. The chance of > > needing a revert from the simple 1:1 conversions is much lower than the > > need

Re: [PATCH v5 0/7] treewide cleanup of random integer usage

2022-10-08 Thread Yury Norov
On Fri, Oct 07, 2022 at 11:53:52PM -0600, Jason A. Donenfeld wrote: > Changes v4->v5: > - Coccinelle is now used for as much mechanical aspects as possible, > with mechanical parts split off from non-mechanical parts. This should > drastically reduce the amount of code that needs to be

Re: [PATCH v5 0/7] treewide cleanup of random integer usage

2022-10-08 Thread Greg Kroah-Hartman
On Fri, Oct 07, 2022 at 11:53:52PM -0600, Jason A. Donenfeld wrote: > Changes v4->v5: > - Coccinelle is now used for as much mechanical aspects as possible, > with mechanical parts split off from non-mechanical parts. This should > drastically reduce the amount of code that needs to be

Re: [PATCH] soc: fsl: qe: Add check for ioremap

2022-10-08 Thread kernel test robot
' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jiasheng-Jiang/soc-fsl-qe-Add-check-for-ioremap/20221008-104034 base: https://git.kernel.org/pub/scm/linux/kernel/git/soc/soc.git for-next config: powerpc

Re: [RFC PATCH 0/5] Generic IPI sending tracepoint

2022-10-08 Thread Steven Rostedt
On Fri, 7 Oct 2022 17:01:33 -0300 Marcelo Tosatti wrote: > > As for the targeted CPUs, the existing tracepoint does export them, albeit > > in > > cpumask form, which is quite inconvenient from a tooling perspective. For > > instance, as far as I'm aware, it's not possible to do event filtering

Re: [RFC PATCH 4/5] irq_work: Trace calls to arch_irq_work_raise()

2022-10-08 Thread Steven Rostedt
On Fri, 7 Oct 2022 16:45:32 +0100 Valentin Schneider wrote: > } > > +static inline void irq_work_raise(void) > +{ > + if (arch_irq_work_has_interrupt()) > + trace_ipi_send_cpu(_RET_IP_, smp_processor_id()); To save on the branch, let's make the above: if

Re: [PATCH v4 2/6] treewide: use prandom_u32_max() when possible

2022-10-08 Thread Andy Shevchenko
On Fri, Oct 07, 2022 at 08:50:43PM -0700, Kees Cook wrote: > On October 7, 2022 7:21:28 PM PDT, "Jason A. Donenfeld" > wrote: > >On Fri, Oct 07, 2022 at 03:47:44PM -0700, Kees Cook wrote: > >> On Fri, Oct 07, 2022 at 12:01:03PM -0600, Jason A. Donenfeld wrote: ... > >> These are more fun, but

Re: [PATCH v4 2/6] treewide: use prandom_u32_max() when possible

2022-10-08 Thread Julia Lawall
> >> @minus_one@ > >> expression FULL; > >> @@ > >> > >> - (get_random_int() & ((FULL) - 1) > >> + prandom_u32_max(FULL) > > > >Ahh, well, okay, this is the example I mentioned above. Only works if > >FULL is saturated. Any clever way to get coccinelle to prove that? Can > >it look at the value of

Re: [PATCH v3] i2c/pasemi: PASemi I2C controller IRQ enablement

2022-10-08 Thread Sven Peter
Hi, > On 7. Oct 2022, at 02:43, Arminder Singh wrote: > > This patch adds IRQ support to the PASemi I2C controller driver to > increase the performace of I2C transactions on platforms with PASemi I2C > controllers. While primarily intended for Apple silicon platforms, this > patch should

[PATCH v5 7/7] prandom: remove unused functions

2022-10-08 Thread Jason A. Donenfeld
With no callers left of prandom_u32() and prandom_bytes(), as well as get_random_int(), remove these deprecated wrappers, in favor of get_random_u32() and get_random_bytes(). Reviewed-by: Kees Cook Signed-off-by: Jason A. Donenfeld --- drivers/char/random.c | 11 +--

[PATCH v5 6/7] treewide: use get_random_bytes when possible

2022-10-08 Thread Jason A. Donenfeld
The prandom_bytes() function has been a deprecated inline wrapper around get_random_bytes() for several releases now, and compiles down to the exact same code. Replace the deprecated wrapper with a direct call to the real function. This was done as a basic find and replace. Reviewed-by: Kees Cook

[PATCH v5 5/7] treewide: use get_random_u32() when possible

2022-10-08 Thread Jason A. Donenfeld
The prandom_u32() function has been a deprecated inline wrapper around get_random_u32() for several releases now, and compiles down to the exact same code. Replace the deprecated wrapper with a direct call to the real function. The same also applies to get_random_int(), which is just a wrapper

[PATCH v5 4/7] treewide: use get_random_{u8,u16}() when possible, part 2

2022-10-08 Thread Jason A. Donenfeld
Rather than truncate a 32-bit value to a 16-bit value or an 8-bit value, simply use the get_random_{u8,u16}() functions, which are faster than wasting the additional bytes from a 32-bit value. This was done by hand, identifying all of the places where one of the random integer functions was used

[PATCH v5 3/7] treewide: use get_random_{u8,u16}() when possible, part 1

2022-10-08 Thread Jason A. Donenfeld
Rather than truncate a 32-bit value to a 16-bit value or an 8-bit value, simply use the get_random_{u8,u16}() functions, which are faster than wasting the additional bytes from a 32-bit value. This was done mechanically with this coccinelle script: @@ expression E; identifier get_random_u32 =~

[PATCH v5 2/7] treewide: use prandom_u32_max() when possible, part 2

2022-10-08 Thread Jason A. Donenfeld
Rather than incurring a division or requesting too many random bytes for the given range, use the prandom_u32_max() function, which only takes the minimum required bytes from the RNG and avoids divisions. This was done by hand, covering things that coccinelle could not do on its own. Reviewed-by:

[PATCH v5 1/7] treewide: use prandom_u32_max() when possible, part 1

2022-10-08 Thread Jason A. Donenfeld
Rather than incurring a division or requesting too many random bytes for the given range, use the prandom_u32_max() function, which only takes the minimum required bytes from the RNG and avoids divisions. This was done mechanically with this coccinelle script: @basic@ expression E; type T;

[PATCH v5 0/7] treewide cleanup of random integer usage

2022-10-08 Thread Jason A. Donenfeld
Changes v4->v5: - Coccinelle is now used for as much mechanical aspects as possible, with mechanical parts split off from non-mechanical parts. This should drastically reduce the amount of code that needs to be reviewed carefully. Each commit mentions now if it was done by hand or is

Re: [PATCH v4 2/6] treewide: use prandom_u32_max() when possible

2022-10-08 Thread Kees Cook
[resending because I failed to CC] On October 7, 2022 7:21:28 PM PDT, "Jason A. Donenfeld" wrote: >On Fri, Oct 07, 2022 at 03:47:44PM -0700, Kees Cook wrote: >> On Fri, Oct 07, 2022 at 12:01:03PM -0600, Jason A. Donenfeld wrote: >> > Rather than incurring a division or requesting too many random

Re: [PATCH v4 2/6] treewide: use prandom_u32_max() when possible

2022-10-08 Thread Jason A. Donenfeld
On Fri, Oct 07, 2022 at 03:47:44PM -0700, Kees Cook wrote: > > diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c > > index 4f2f2d1bac56..56ffaa8dd3f6 100644 > > --- a/lib/test_vmalloc.c > > +++ b/lib/test_vmalloc.c > > @@ -151,9 +151,7 @@ static int random_size_alloc_test(void) > > int i; >