From 87d6621c07d230d9168a021f2760062f2262e8b9 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 12 Oct 2023 13:11:25 +0800 Subject: crypto: lskcipher - Return EINVAL when ecb_name fails sanity checks Set the error value to -EINVAL instead of zero when the underlying name (within "ecb()") fails basic sanity checks. Fixes: 8aee5d4ebd11 ("crypto: lskcipher - Add compatibility wrapper around ECB") Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202310111323.ZjK7bzjw-lkp@intel.com/ Signed-off-by: Herbert Xu --- crypto/lskcipher.c | 1 + 1 file changed, 1 insertion(+) (limited to 'crypto') diff --git a/crypto/lskcipher.c b/crypto/lskcipher.c index 9be3c04bc62a..cb6170ebcaa3 100644 --- a/crypto/lskcipher.c +++ b/crypto/lskcipher.c @@ -583,6 +583,7 @@ struct lskcipher_instance *lskcipher_alloc_instance_simple( if (ecb_name[0]) { int len; + err = -EINVAL; len = strscpy(ecb_name, &cipher_alg->co.base.cra_name[4], sizeof(ecb_name)); if (len < 2) -- cgit v1.2.3