On Fri, Apr 25, 2025 at 07:23:49AM +0800, kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: 393d0c54cae31317deaa9043320c5fd9454deabc > commit: 04bfa4c7d5119ca38f8133bfdae7957a60c8b221 [3678/6092] crypto: hash - Add HASH_REQUEST_ON_STACK > config: um-randconfig-r063-20250425 (https://download.01.org/0day-ci/archive/20250425/202504250751.mdy28Ibr-lkp@xxxxxxxxx/config) > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250425/202504250751.mdy28Ibr-lkp@xxxxxxxxx/reproduce) ---8<--- Add a helper to initialise crypto stack requests and use it for ahash and acomp. Make sure that the flags field is initialised fully in the helper to silence false-positive warnings from the compiler. Reported-by: kernel test robot <lkp@xxxxxxxxx> Closes: https://lore.kernel.org/oe-kbuild-all/202504250751.mdy28Ibr-lkp@xxxxxxxxx/ Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> diff --git a/include/crypto/acompress.h b/include/crypto/acompress.h index 1b30290d6380..50849c4de0dc 100644 --- a/include/crypto/acompress.h +++ b/include/crypto/acompress.h @@ -548,8 +548,7 @@ static inline struct acomp_req *acomp_request_on_stack_init( { struct acomp_req *req = (void *)buf; - acomp_request_set_tfm(req, tfm); - req->base.flags = CRYPTO_TFM_REQ_ON_STACK; + crypto_stack_request_init(&req->base, crypto_acomp_tfm(tfm)); return req; } diff --git a/include/crypto/hash.h b/include/crypto/hash.h index 5f87d1040a7c..bf0c4c441ee4 100644 --- a/include/crypto/hash.h +++ b/include/crypto/hash.h @@ -1030,8 +1030,7 @@ static inline struct ahash_request *ahash_request_on_stack_init( { struct ahash_request *req = (void *)buf; - ahash_request_set_tfm(req, tfm); - req->base.flags = CRYPTO_TFM_REQ_ON_STACK; + crypto_stack_request_init(&req->base, crypto_ahash_tfm(tfm)); return req; } diff --git a/include/crypto/internal/acompress.h b/include/crypto/internal/acompress.h index 7eda32619024..8a5b116abaa3 100644 --- a/include/crypto/internal/acompress.h +++ b/include/crypto/internal/acompress.h @@ -226,8 +226,7 @@ static inline struct acomp_req *acomp_fbreq_on_stack_init( struct crypto_acomp *tfm = crypto_acomp_reqtfm(old); struct acomp_req *req = (void *)buf; - acomp_request_set_tfm(req, tfm->fb); - req->base.flags = CRYPTO_TFM_REQ_ON_STACK; + crypto_stack_request_init(&req->base, crypto_acomp_tfm(tfm->fb)); acomp_request_set_callback(req, acomp_request_flags(old), NULL, NULL); req->base.flags &= ~CRYPTO_ACOMP_REQ_PRIVATE; req->base.flags |= old->base.flags & CRYPTO_ACOMP_REQ_PRIVATE; diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h index 1e80dd084a23..bba3ed3459a1 100644 --- a/include/crypto/internal/hash.h +++ b/include/crypto/internal/hash.h @@ -278,8 +278,7 @@ static inline struct ahash_request *ahash_fbreq_on_stack_init( struct crypto_ahash *tfm = crypto_ahash_reqtfm(old); struct ahash_request *req = (void *)buf; - ahash_request_set_tfm(req, tfm->fb); - req->base.flags = CRYPTO_TFM_REQ_ON_STACK; + crypto_stack_request_init(&req->base, crypto_ahash_tfm(tfm->fb)); ahash_request_set_callback(req, ahash_request_flags(old), NULL, NULL); req->base.flags &= ~CRYPTO_AHASH_REQ_PRIVATE; req->base.flags |= old->base.flags & CRYPTO_AHASH_REQ_PRIVATE; diff --git a/include/linux/crypto.h b/include/linux/crypto.h index f691ce01745e..a17b980c4dd3 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -509,5 +509,13 @@ static inline void crypto_request_set_tfm(struct crypto_async_request *req, req->flags &= ~CRYPTO_TFM_REQ_ON_STACK; } +static inline void crypto_stack_request_init(struct crypto_async_request *req, + struct crypto_tfm *tfm) +{ + req->flags = 0; + crypto_request_set_tfm(req, tfm); + req->flags |= CRYPTO_TFM_REQ_ON_STACK; +} + #endif /* _LINUX_CRYPTO_H */ -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt