Re: [PATCH v1 3/3] s390/crypto: New s390 specific shash phmac

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Harald,

kernel test robot noticed the following build warnings:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[also build test WARNING on s390/features linus/master v6.12-rc5 next-20241031]
[cannot apply to herbert-crypto-2.6/master]
[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/Harald-Freudenberger/crypto-api-Adjust-HASH_MAX_DESCSIZE-for-phmac-context-on-s390/20241031-002930
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20241030162235.363533-4-freude%40linux.ibm.com
patch subject: [PATCH v1 3/3] s390/crypto: New s390 specific shash phmac
config: s390-randconfig-r053-20241101 (https://download.01.org/0day-ci/archive/20241101/202411010609.n8fzUWMm-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411010609.n8fzUWMm-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> arch/s390/crypto/phmac_s390.c:165:16-23: WARNING opportunity for kmemdup

vim +165 arch/s390/crypto/phmac_s390.c

   152	
   153	static inline int s390_phmac_sha2_setkey(struct crypto_shash *tfm,
   154						 const u8 *key, unsigned int keylen)
   155	{
   156		struct s390_phmac_ctx *tfm_ctx = crypto_shash_ctx(tfm);
   157		int rc = -ENOMEM;
   158	
   159		if (tfm_ctx->keylen) {
   160			kfree_sensitive(tfm_ctx->key);
   161			tfm_ctx->key = NULL;
   162			tfm_ctx->keylen = 0;
   163		}
   164	
 > 165		tfm_ctx->key = kmalloc(keylen, GFP_KERNEL);
   166		if (!tfm_ctx->key)
   167			goto out;
   168		memcpy(tfm_ctx->key, key, keylen);
   169		tfm_ctx->keylen = keylen;
   170	
   171		rc = phmac_convert_key(tfm_ctx);
   172		if (rc)
   173			goto out;
   174	
   175		rc = -EINVAL;
   176		switch (crypto_shash_digestsize(tfm)) {
   177		case SHA224_DIGEST_SIZE:
   178		case SHA256_DIGEST_SIZE:
   179			if (tfm_ctx->pk.type != PKEY_KEYTYPE_HMAC_512)
   180				goto out;
   181			break;
   182		case SHA384_DIGEST_SIZE:
   183		case SHA512_DIGEST_SIZE:
   184			if (tfm_ctx->pk.type != PKEY_KEYTYPE_HMAC_1024)
   185				goto out;
   186			break;
   187		default:
   188			goto out;
   189		}
   190		rc = 0;
   191	
   192	out:
   193		pr_debug("rc=%d\n", rc);
   194		return rc;
   195	}
   196	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux