Re: [PATCH v3 RESEND 8/9] crypto/ycc: Add sm2 algorithm support

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

 



Hi 'Guanjun',

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Guanjun/Drivers-for-Alibaba-YCC-Yitian-Cryptography-Complex-cryptographic-accelerator/20221103-154448
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/1667461243-48652-9-git-send-email-guanjun%40linux.alibaba.com
patch subject: [PATCH v3 RESEND 8/9] crypto/ycc: Add sm2 algorithm support
config: ia64-randconfig-m031-20221104
compiler: ia64-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <error27@xxxxxxxxx>

smatch warnings:
drivers/crypto/ycc/ycc_pke.c:880 ycc_sm2_exit() warn: variable dereferenced before check 'ctx->ring' (see line 878)

vim +880 drivers/crypto/ycc/ycc_pke.c

eb2973011f26b6 Xuchun Shang 2022-11-03  875  static void ycc_sm2_exit(struct crypto_akcipher *tfm)
eb2973011f26b6 Xuchun Shang 2022-11-03  876  {
eb2973011f26b6 Xuchun Shang 2022-11-03  877  	struct ycc_pke_ctx *ctx = akcipher_tfm_ctx(tfm);
eb2973011f26b6 Xuchun Shang 2022-11-03 @878  	struct device *dev = YCC_DEV(ctx);

ctx->ring dereferenced inside YCC_DEV() (says the checker).

eb2973011f26b6 Xuchun Shang 2022-11-03  879  
eb2973011f26b6 Xuchun Shang 2022-11-03 @880  	if (ctx->ring)
                                                    ^^^^^^^^^
Checked too late.

eb2973011f26b6 Xuchun Shang 2022-11-03  881  		ycc_crypto_free_ring(ctx->ring);
eb2973011f26b6 Xuchun Shang 2022-11-03  882  
eb2973011f26b6 Xuchun Shang 2022-11-03  883  	if (ctx->pub_key_vaddr)
eb2973011f26b6 Xuchun Shang 2022-11-03  884  		dma_free_coherent(dev, 64, ctx->pub_key_vaddr, ctx->pub_key_paddr);
eb2973011f26b6 Xuchun Shang 2022-11-03  885  
eb2973011f26b6 Xuchun Shang 2022-11-03  886  	crypto_free_akcipher(ctx->soft_tfm);
eb2973011f26b6 Xuchun Shang 2022-11-03  887  }

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




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