Re: [PATCH] fscrypt: Replace some variable-size memsets with fixed-size

From: Eric Biggers

Date: Mon Jul 20 2026 - 13:53:46 EST


On Sat, Jul 18, 2026 at 01:56:06PM -0700, Eric Biggers wrote:
> For zeroing IVs and raw keys, remove the misguided optimization of
> zeroing the actual size used (typically 16 and 64 bytes respectively)
> instead of the max size (32 and 64 bytes respectively). Using a
> compile-time constant size allows the compiler to specialize the memset
> for that size (typically by inlining a few 'mov' instructions), which
> is more important than zeroing a few extra bytes with these small sizes.
>
> Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
> ---
> fs/crypto/crypto.c | 2 +-
> fs/crypto/keysetup.c | 4 ++--
> fs/crypto/keysetup_v1.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)

Applied to https://git.kernel.org/pub/scm/fs/fscrypt/linux.git/log/?h=for-next

- Eric