2022-11-22 10:16:06

by Herbert Xu

[permalink] [raw]
Subject: [PATCH] crypto: dh - Use helper to set reqsize

The value of reqsize must only be changed through the helper.

Signed-off-by: Herbert Xu <[email protected]>

diff --git a/crypto/dh.c b/crypto/dh.c
index 99c3b2ef7adc..e39c1bde1ac0 100644
--- a/crypto/dh.c
+++ b/crypto/dh.c
@@ -318,6 +318,9 @@ static int dh_safe_prime_init_tfm(struct crypto_kpp *tfm)
if (IS_ERR(tfm_ctx->dh_tfm))
return PTR_ERR(tfm_ctx->dh_tfm);

+ kpp_set_reqsize(tfm, sizeof(struct kpp_request) +
+ crypto_kpp_reqsize(tfm_ctx->dh_tfm));
+
return 0;
}

@@ -593,7 +596,6 @@ static int __maybe_unused __dh_safe_prime_create(
inst->alg.max_size = dh_safe_prime_max_size;
inst->alg.init = dh_safe_prime_init_tfm;
inst->alg.exit = dh_safe_prime_exit_tfm;
- inst->alg.reqsize = sizeof(struct kpp_request) + dh_alg->reqsize;
inst->alg.base.cra_priority = dh_alg->base.cra_priority;
inst->alg.base.cra_module = THIS_MODULE;
inst->alg.base.cra_ctxsize = sizeof(struct dh_safe_prime_tfm_ctx);
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


2022-12-01 22:34:03

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] crypto: dh - Use helper to set reqsize

Hi Herbert,

I love your patch! Yet something to improve:

[auto build test ERROR on herbert-cryptodev-2.6/master]
[also build test ERROR on herbert-crypto-2.6/master linus/master v6.1-rc7 next-20221201]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Herbert-Xu/crypto-dh-Use-helper-to-set-reqsize/20221122-180747
base: https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link: https://lore.kernel.org/r/Y3yfQKX1GVkfHOe0%40gondor.apana.org.au
patch subject: [PATCH] crypto: dh - Use helper to set reqsize
config: x86_64-rhel-8.3
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/501307c5370bc04b3091ecc69b45c0d6ed25fcbe
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Herbert-Xu/crypto-dh-Use-helper-to-set-reqsize/20221122-180747
git checkout 501307c5370bc04b3091ecc69b45c0d6ed25fcbe
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash crypto/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

crypto/dh.c: In function 'dh_safe_prime_init_tfm':
>> crypto/dh.c:321:9: error: implicit declaration of function 'kpp_set_reqsize' [-Werror=implicit-function-declaration]
321 | kpp_set_reqsize(tfm, sizeof(struct kpp_request) +
| ^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +/kpp_set_reqsize +321 crypto/dh.c

310
311 static int dh_safe_prime_init_tfm(struct crypto_kpp *tfm)
312 {
313 struct dh_safe_prime_instance_ctx *inst_ctx =
314 dh_safe_prime_instance_ctx(tfm);
315 struct dh_safe_prime_tfm_ctx *tfm_ctx = kpp_tfm_ctx(tfm);
316
317 tfm_ctx->dh_tfm = crypto_spawn_kpp(&inst_ctx->dh_spawn);
318 if (IS_ERR(tfm_ctx->dh_tfm))
319 return PTR_ERR(tfm_ctx->dh_tfm);
320
> 321 kpp_set_reqsize(tfm, sizeof(struct kpp_request) +
322 crypto_kpp_reqsize(tfm_ctx->dh_tfm));
323
324 return 0;
325 }
326

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (2.48 kB)
config (168.50 kB)
Download all attachments