Re: [f2fs-dev] [PATCH v1 0/5] treewide cleanup of random integer usage

2022-10-06 Thread Jason A. Donenfeld via Linux-f2fs-devel
A v2 that won't murder your mail setup is now available here: https://lore.kernel.org/lkml/[email protected]/ Please do not (attempt to) post more replies to v1, as it kicks up a storm of angry MTAs. ___ Linux-f2fs-devel mailing li

Re: [f2fs-dev] [PATCH v1 3/5] treewide: use get_random_u32() when possible

2022-10-06 Thread Jason A. Donenfeld via Linux-f2fs-devel
On Thu, Oct 6, 2022 at 7:01 AM Andy Shevchenko wrote: > > On Thu, Oct 06, 2022 at 06:33:15AM -0600, Jason A. Donenfeld wrote: > > On Thu, Oct 06, 2022 at 10:43:31AM +0200, Jan Kara wrote: > > ... > > > > The code here is effectively doing the > > > > > > parent_group = prandom_u32_max(ngroups)

Re: [f2fs-dev] [PATCH v1 3/5] treewide: use get_random_u32() when possible

2022-10-06 Thread Jason A. Donenfeld via Linux-f2fs-devel
On Thu, Oct 6, 2022 at 6:47 AM Jason Gunthorpe wrote: > > On Wed, Oct 05, 2022 at 11:48:42PM +0200, Jason A. Donenfeld wrote: > > > index 14392c942f49..499a425a3379 100644 > > --- a/drivers/infiniband/hw/cxgb4/cm.c > > +++ b/drivers/infiniband/hw/cxgb4/cm.c > > @@ -734,7 +734,7 @@ static int send_

Re: [f2fs-dev] [PATCH v1 0/5] treewide cleanup of random integer usage

2022-10-06 Thread Jason A. Donenfeld via Linux-f2fs-devel
On Wed, Oct 05, 2022 at 09:55:43PM -0700, Kees Cook wrote: > It'd be nice to capture some (all?) of the above somewhere. Perhaps just > a massive comment in the header? I'll include (something like) this in some "how to use" documentation I'm working on separately. > > I've CC'd get_maintainers.p

Re: [f2fs-dev] [PATCH v1 1/5] treewide: use prandom_u32_max() when possible

2022-10-06 Thread Jason A. Donenfeld via Linux-f2fs-devel
Hi Kees, On Wed, Oct 05, 2022 at 09:16:50PM -0700, Kees Cook wrote: > On Wed, Oct 05, 2022 at 11:48:40PM +0200, Jason A. Donenfeld wrote: > > 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 m

Re: [f2fs-dev] [PATCH v1 3/5] treewide: use get_random_u32() when possible

2022-10-06 Thread Jason A. Donenfeld via Linux-f2fs-devel
On Thu, Oct 06, 2022 at 10:43:31AM +0200, Jan Kara wrote: > The code here is effectively doing the > > parent_group = prandom_u32_max(ngroups); > > Similarly here we can use prandom_u32_max(ngroups) like: > > if (qstr) { > ... > par

Re: [f2fs-dev] [PATCH v1 2/5] treewide: use get_random_{u8, u16}() when possible

2022-10-06 Thread Jason A. Donenfeld via Linux-f2fs-devel
On Wed, Oct 05, 2022 at 09:38:02PM -0700, Kees Cook wrote: > > diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c > > index 56ffaa8dd3f6..0131ed2cd1bd 100644 > > --- a/lib/test_vmalloc.c > > +++ b/lib/test_vmalloc.c > > @@ -80,7 +80,7 @@ static int random_size_align_alloc_test(void) > > int i

[f2fs-dev] [PATCH v1 5/5] prandom: remove unused functions

2022-10-05 Thread Jason A. Donenfeld via Linux-f2fs-devel
With no callers left of prandom_u32() and prandom_bytes(), remove these deprecated wrappers. Signed-off-by: Jason A. Donenfeld --- include/linux/prandom.h | 12 1 file changed, 12 deletions(-) diff --git a/include/linux/prandom.h b/include/linux/prandom.h index 78db003bc290..e0a075

[f2fs-dev] [PATCH v1 4/5] treewide: use get_random_bytes when possible

2022-10-05 Thread Jason A. Donenfeld via Linux-f2fs-devel
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. Signed-off-by: Jason A. Donenfeld --- arch/powerpc/crypto/crc-vp

[f2fs-dev] [PATCH v1 3/5] treewide: use get_random_u32() when possible

2022-10-05 Thread Jason A. Donenfeld via Linux-f2fs-devel
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. Signed-off-by: Jason A. Donenfeld --- Documentation/networking/filte

[f2fs-dev] [PATCH v1 2/5] treewide: use get_random_{u8, u16}() when possible

2022-10-05 Thread Jason A. Donenfeld via Linux-f2fs-devel
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. Signed-off-by: Jason A. Donenfeld --- crypto/testmgr.c | 8 +++

[f2fs-dev] [PATCH v1 1/5] treewide: use prandom_u32_max() when possible

2022-10-05 Thread Jason A. Donenfeld via Linux-f2fs-devel
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. Signed-off-by: Jason A. Donenfeld --- arch/x86/mm/pat/cpa-test.c| 4 +-