[herbert-cryptodev-2.6:master 20/50] drivers/crypto/qce/sha.c:365:3: error: cannot jump from this goto statement to its label

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
head:   4ebd9a5ca478673cfbb38795cc5b3adb4f35fe04
commit: ce8fd0500b741b3669c246cc604f1f2343cdd6fd [20/50] crypto: qce - use __free() for a buffer that's always freed
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250103/202501032355.vSmyIynw-lkp@xxxxxxxxx/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250103/202501032355.vSmyIynw-lkp@xxxxxxxxx/reproduce)

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/202501032355.vSmyIynw-lkp@xxxxxxxxx/

Note: the herbert-cryptodev-2.6/master HEAD 4ebd9a5ca478673cfbb38795cc5b3adb4f35fe04 builds fine.
      It only hurts bisectability.

All errors (new ones prefixed by >>):

   In file included from drivers/crypto/qce/sha.c:8:
   In file included from include/linux/dma-mapping.h:8:
   In file included from include/linux/scatterlist.h:8:
   In file included from include/linux/mm.h:2223:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/crypto/qce/sha.c:365:3: error: cannot jump from this goto statement to its label
     365 |                 goto err_free_ahash;
         |                 ^
   drivers/crypto/qce/sha.c:373:6: note: jump bypasses initialization of variable with __attribute__((cleanup))
     373 |         u8 *buf __free(kfree) = kzalloc(keylen + QCE_MAX_ALIGN_SIZE,
         |             ^
   4 warnings and 1 error generated.


vim +365 drivers/crypto/qce/sha.c

ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  329  
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  330  static int qce_ahash_hmac_setkey(struct crypto_ahash *tfm, const u8 *key,
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  331  				 unsigned int keylen)
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  332  {
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  333  	unsigned int digestsize = crypto_ahash_digestsize(tfm);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  334  	struct qce_sha_ctx *ctx = crypto_tfm_ctx(&tfm->base);
c70e5f9403103c Gilad Ben-Yossef    2017-10-18  335  	struct crypto_wait wait;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  336  	struct ahash_request *req;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  337  	struct scatterlist sg;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  338  	unsigned int blocksize;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  339  	struct crypto_ahash *ahash_tfm;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  340  	int ret;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  341  	const char *alg_name;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  342  
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  343  	blocksize = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  344  	memset(ctx->authkey, 0, sizeof(ctx->authkey));
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  345  
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  346  	if (keylen <= blocksize) {
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  347  		memcpy(ctx->authkey, key, keylen);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  348  		return 0;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  349  	}
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  350  
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  351  	if (digestsize == SHA1_DIGEST_SIZE)
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  352  		alg_name = "sha1-qce";
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  353  	else if (digestsize == SHA256_DIGEST_SIZE)
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  354  		alg_name = "sha256-qce";
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  355  	else
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  356  		return -EINVAL;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  357  
85d7311f1908b9 Eric Biggers        2018-06-30  358  	ahash_tfm = crypto_alloc_ahash(alg_name, 0, 0);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  359  	if (IS_ERR(ahash_tfm))
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  360  		return PTR_ERR(ahash_tfm);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  361  
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  362  	req = ahash_request_alloc(ahash_tfm, GFP_KERNEL);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  363  	if (!req) {
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  364  		ret = -ENOMEM;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25 @365  		goto err_free_ahash;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  366  	}
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  367  
c70e5f9403103c Gilad Ben-Yossef    2017-10-18  368  	crypto_init_wait(&wait);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  369  	ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
c70e5f9403103c Gilad Ben-Yossef    2017-10-18  370  				   crypto_req_done, &wait);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  371  	crypto_ahash_clear_flags(ahash_tfm, ~0);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  372  
ce8fd0500b741b Bartosz Golaszewski 2024-12-03  373  	u8 *buf __free(kfree) = kzalloc(keylen + QCE_MAX_ALIGN_SIZE,
ce8fd0500b741b Bartosz Golaszewski 2024-12-03  374  					GFP_KERNEL);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  375  	if (!buf) {
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  376  		ret = -ENOMEM;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  377  		goto err_free_req;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  378  	}
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  379  
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  380  	memcpy(buf, key, keylen);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  381  	sg_init_one(&sg, buf, keylen);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  382  	ahash_request_set_crypt(req, &sg, ctx->authkey, keylen);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  383  
c70e5f9403103c Gilad Ben-Yossef    2017-10-18  384  	ret = crypto_wait_req(crypto_ahash_digest(req), &wait);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  385  
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  386  err_free_req:
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  387  	ahash_request_free(req);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  388  err_free_ahash:
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  389  	crypto_free_ahash(ahash_tfm);
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  390  	return ret;
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  391  }
ec8f5d8f6f76b9 Stanimir Varbanov   2014-06-25  392  

:::::: The code at line 365 was first introduced by commit
:::::: ec8f5d8f6f76b939f662d6e83041abecabef0a34 crypto: qce - Qualcomm crypto engine driver

:::::: TO: Stanimir Varbanov <svarbanov@xxxxxxxxxx>
:::::: CC: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

-- 
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