Re: [PATCH 4/4] Enable Driver compilation in crypto Kconfig and Makefile file

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

 



Hi Pavitrakumar,

kernel test robot noticed the following build warnings:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Pavitrakumar-M/Add-SPAcc-driver-to-Linux-kernel/20240305-193337
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20240305112831.3380896-5-pavitrakumarm%40vayavyalabs.com
patch subject: [PATCH 4/4] Enable Driver compilation in crypto Kconfig and Makefile file
config: i386-randconfig-141-20240308 (https://download.01.org/0day-ci/archive/20240311/202403111044.eqxBgcDl-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

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>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202403111044.eqxBgcDl-lkp@xxxxxxxxx/

New smatch warnings:
drivers/crypto/dwc-spacc/spacc_skcipher.c:176 spacc_cipher_cb() warn: was && intended here instead of ||?
drivers/crypto/dwc-spacc/spacc_aead.c:1131 spacc_aead_process() error: uninitialized symbol 'ptaadsize'.

vim +176 drivers/crypto/dwc-spacc/spacc_skcipher.c

6ad822cec22644 Pavitrakumar M 2024-03-05  146  static void spacc_cipher_cb(void *spacc, void *tfm)
6ad822cec22644 Pavitrakumar M 2024-03-05  147  {
6ad822cec22644 Pavitrakumar M 2024-03-05  148  	struct cipher_cb_data *cb = tfm;
6ad822cec22644 Pavitrakumar M 2024-03-05  149  	int err = -1, rc;
6ad822cec22644 Pavitrakumar M 2024-03-05  150  	int total_len;
6ad822cec22644 Pavitrakumar M 2024-03-05  151  	struct spacc_crypto_reqctx *ctx = skcipher_request_ctx(cb->req);
6ad822cec22644 Pavitrakumar M 2024-03-05  152  
6ad822cec22644 Pavitrakumar M 2024-03-05  153  	u32 status_reg = readl(cb->spacc->regmap + SPACC_REG_STATUS);
6ad822cec22644 Pavitrakumar M 2024-03-05  154  	u32 status_ret = (status_reg >> 24) & 0x03;
6ad822cec22644 Pavitrakumar M 2024-03-05  155  
6ad822cec22644 Pavitrakumar M 2024-03-05  156  	if (ctx->mode == CRYPTO_MODE_DES_CBC ||
6ad822cec22644 Pavitrakumar M 2024-03-05  157  	    ctx->mode == CRYPTO_MODE_3DES_CBC) {
6ad822cec22644 Pavitrakumar M 2024-03-05  158  		rc = spacc_read_context(cb->spacc, cb->tctx->handle,
6ad822cec22644 Pavitrakumar M 2024-03-05  159  					SPACC_CRYPTO_OPERATION, NULL, 0,
6ad822cec22644 Pavitrakumar M 2024-03-05  160  					cb->req->iv, 8);
6ad822cec22644 Pavitrakumar M 2024-03-05  161  	} else if (ctx->mode != CRYPTO_MODE_DES_ECB  &&
6ad822cec22644 Pavitrakumar M 2024-03-05  162  		   ctx->mode != CRYPTO_MODE_3DES_ECB &&
6ad822cec22644 Pavitrakumar M 2024-03-05  163  		   ctx->mode != CRYPTO_MODE_SM4_ECB  &&
6ad822cec22644 Pavitrakumar M 2024-03-05  164  		   ctx->mode != CRYPTO_MODE_AES_ECB  &&
6ad822cec22644 Pavitrakumar M 2024-03-05  165  		   ctx->mode != CRYPTO_MODE_SM4_XTS  &&
6ad822cec22644 Pavitrakumar M 2024-03-05  166  		   ctx->mode != CRYPTO_MODE_KASUMI_ECB) {
6ad822cec22644 Pavitrakumar M 2024-03-05  167  		if (status_ret == 0x3) {
6ad822cec22644 Pavitrakumar M 2024-03-05  168  			err = -EINVAL;
6ad822cec22644 Pavitrakumar M 2024-03-05  169  			goto REQ_DST_CP_SKIP;
6ad822cec22644 Pavitrakumar M 2024-03-05  170  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  171  		rc = spacc_read_context(cb->spacc, cb->tctx->handle,
6ad822cec22644 Pavitrakumar M 2024-03-05  172  					SPACC_CRYPTO_OPERATION, NULL, 0,
6ad822cec22644 Pavitrakumar M 2024-03-05  173  					cb->req->iv, 16);
6ad822cec22644 Pavitrakumar M 2024-03-05  174  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  175  
6ad822cec22644 Pavitrakumar M 2024-03-05 @176  	if (ctx->mode != CRYPTO_MODE_DES_ECB  ||
6ad822cec22644 Pavitrakumar M 2024-03-05  177  	    ctx->mode != CRYPTO_MODE_DES_CBC  ||
6ad822cec22644 Pavitrakumar M 2024-03-05  178  	    ctx->mode != CRYPTO_MODE_3DES_ECB ||
6ad822cec22644 Pavitrakumar M 2024-03-05  179  	    ctx->mode != CRYPTO_MODE_3DES_CBC) {

ctx->mode can't possibly be equal to multiple values at the same time
so this condition is always true.  && was intended.

6ad822cec22644 Pavitrakumar M 2024-03-05  180  		if (status_ret == 0x03) {
6ad822cec22644 Pavitrakumar M 2024-03-05  181  			err = -EINVAL;
6ad822cec22644 Pavitrakumar M 2024-03-05  182  			goto REQ_DST_CP_SKIP;
6ad822cec22644 Pavitrakumar M 2024-03-05  183  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  184  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  185  
6ad822cec22644 Pavitrakumar M 2024-03-05  186  	if (ctx->mode == CRYPTO_MODE_SM4_ECB && status_ret == 0x03) {
6ad822cec22644 Pavitrakumar M 2024-03-05  187  		err = -EINVAL;
6ad822cec22644 Pavitrakumar M 2024-03-05  188  		goto REQ_DST_CP_SKIP;
6ad822cec22644 Pavitrakumar M 2024-03-05  189  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  190  
6ad822cec22644 Pavitrakumar M 2024-03-05  191  	total_len = cb->req->cryptlen;
6ad822cec22644 Pavitrakumar M 2024-03-05  192  	if (ctx->mode == CRYPTO_MODE_SM4_XTS && total_len != 16) {
6ad822cec22644 Pavitrakumar M 2024-03-05  193  		if (status_ret == 0x03) {
6ad822cec22644 Pavitrakumar M 2024-03-05  194  			err = -EINVAL;
6ad822cec22644 Pavitrakumar M 2024-03-05  195  			goto REQ_DST_CP_SKIP;
6ad822cec22644 Pavitrakumar M 2024-03-05  196  		}
6ad822cec22644 Pavitrakumar M 2024-03-05  197  	}
6ad822cec22644 Pavitrakumar M 2024-03-05  198  
6ad822cec22644 Pavitrakumar M 2024-03-05  199  	dma_sync_sg_for_cpu(cb->tctx->dev, cb->req->dst, ctx->dst_nents,
6ad822cec22644 Pavitrakumar M 2024-03-05  200  				DMA_FROM_DEVICE);
6ad822cec22644 Pavitrakumar M 2024-03-05  201  
6ad822cec22644 Pavitrakumar M 2024-03-05  202  	err = cb->spacc->job[cb->new_handle].job_err;
6ad822cec22644 Pavitrakumar M 2024-03-05  203  REQ_DST_CP_SKIP:
6ad822cec22644 Pavitrakumar M 2024-03-05  204  	spacc_cipher_cleanup_dma(cb->tctx->dev, cb->req);
6ad822cec22644 Pavitrakumar M 2024-03-05  205  	spacc_close(cb->spacc, cb->new_handle);
6ad822cec22644 Pavitrakumar M 2024-03-05  206  
6ad822cec22644 Pavitrakumar M 2024-03-05  207  	/* call complete */
6ad822cec22644 Pavitrakumar M 2024-03-05  208  	skcipher_request_complete(cb->req, err);
6ad822cec22644 Pavitrakumar M 2024-03-05  209  }

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