Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: api - Add crypto_stack_request_init and initialise flags fully

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@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202504250751.mdy28Ibr-lkp@intel.com/
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+14 -8
+1 -2
include/crypto/acompress.h
··· 547 547 { 548 548 struct acomp_req *req = (void *)buf; 549 549 550 - acomp_request_set_tfm(req, tfm); 551 - req->base.flags = CRYPTO_TFM_REQ_ON_STACK; 550 + crypto_stack_request_init(&req->base, crypto_acomp_tfm(tfm)); 552 551 return req; 553 552 } 554 553
+1 -2
include/crypto/hash.h
··· 1029 1029 { 1030 1030 struct ahash_request *req = (void *)buf; 1031 1031 1032 - ahash_request_set_tfm(req, tfm); 1033 - req->base.flags = CRYPTO_TFM_REQ_ON_STACK; 1032 + crypto_stack_request_init(&req->base, crypto_ahash_tfm(tfm)); 1034 1033 return req; 1035 1034 } 1036 1035
+2 -2
include/crypto/internal/acompress.h
··· 231 231 struct crypto_acomp *tfm = crypto_acomp_reqtfm(old); 232 232 struct acomp_req *req = (void *)buf; 233 233 234 - acomp_request_set_tfm(req, crypto_acomp_fb(tfm)); 235 - req->base.flags = CRYPTO_TFM_REQ_ON_STACK; 234 + crypto_stack_request_init(&req->base, 235 + crypto_acomp_tfm(crypto_acomp_fb(tfm))); 236 236 acomp_request_set_callback(req, acomp_request_flags(old), NULL, NULL); 237 237 req->base.flags &= ~CRYPTO_ACOMP_REQ_PRIVATE; 238 238 req->base.flags |= old->base.flags & CRYPTO_ACOMP_REQ_PRIVATE;
+2 -2
include/crypto/internal/hash.h
··· 283 283 struct crypto_ahash *tfm = crypto_ahash_reqtfm(old); 284 284 struct ahash_request *req = (void *)buf; 285 285 286 - ahash_request_set_tfm(req, crypto_ahash_fb(tfm)); 287 - req->base.flags = CRYPTO_TFM_REQ_ON_STACK; 286 + crypto_stack_request_init(&req->base, 287 + crypto_ahash_tfm(crypto_ahash_fb(tfm))); 288 288 ahash_request_set_callback(req, ahash_request_flags(old), NULL, NULL); 289 289 req->base.flags &= ~CRYPTO_AHASH_REQ_PRIVATE; 290 290 req->base.flags |= old->base.flags & CRYPTO_AHASH_REQ_PRIVATE;
+8
include/linux/crypto.h
··· 514 514 struct crypto_async_request *crypto_request_clone( 515 515 struct crypto_async_request *req, size_t total, gfp_t gfp); 516 516 517 + static inline void crypto_stack_request_init(struct crypto_async_request *req, 518 + struct crypto_tfm *tfm) 519 + { 520 + req->flags = 0; 521 + crypto_request_set_tfm(req, tfm); 522 + req->flags |= CRYPTO_TFM_REQ_ON_STACK; 523 + } 524 + 517 525 #endif /* _LINUX_CRYPTO_H */ 518 526