]> www.infradead.org Git - users/dwmw2/linux.git/commit
crypto: skcipher - Use restrict rather than hand-rolling accesses
authorHerbert Xu <herbert@gondor.apana.org.au>
Sun, 23 Feb 2025 06:27:51 +0000 (14:27 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sun, 2 Mar 2025 07:21:47 +0000 (15:21 +0800)
commitf79d2d2852facc72b91a78e5c423722c7dc53d72
tree54930887abed53572f0bf898adeedc33f56bd5e5
parent006401d29a5cc3774b035e933ca6f063134b8433
crypto: skcipher - Use restrict rather than hand-rolling accesses

Rather than accessing 'alg' directly to avoid the aliasing issue
which leads to unnecessary reloads, use the __restrict keyword
to explicitly tell the compiler that there is no aliasing.

This generates equivalent if not superior code on x86 with gcc 12.

Note that in skcipher_walk_virt the alg assignment is moved after
might_sleep_if because that function is a compiler barrier and
forces a reload.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/skcipher.c
include/crypto/internal/skcipher.h