[kbuild] Re: [Patch v3 6/7] crypto: qce: common: Add support for AEAD algorithms

2021-04-28 Thread Dan Carpenter
Hi Thara,

url:
https://github.com/0day-ci/linux/commits/Thara-Gopinath/Add-support-for-AEAD-algorithms-in-Qualcomm-Crypto-Engine-driver/20210420-113944
 
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git  
master
config: arm-randconfig-m031-20210428 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/crypto/qce/common.c:482 qce_setup_regs_aead() error: uninitialized 
symbol 'auth_ivsize'.

vim +/auth_ivsize +482 drivers/crypto/qce/common.c

b152c1b17bb6ad Thara Gopinath 2021-04-19  419  static int 
qce_setup_regs_aead(struct crypto_async_request *async_req)
b152c1b17bb6ad Thara Gopinath 2021-04-19  420  {
b152c1b17bb6ad Thara Gopinath 2021-04-19  421   struct aead_request *req = 
aead_request_cast(async_req);
b152c1b17bb6ad Thara Gopinath 2021-04-19  422   struct qce_aead_reqctx *rctx = 
aead_request_ctx(req);
b152c1b17bb6ad Thara Gopinath 2021-04-19  423   struct qce_aead_ctx *ctx = 
crypto_tfm_ctx(async_req->tfm);
b152c1b17bb6ad Thara Gopinath 2021-04-19  424   struct qce_alg_template *tmpl = 
to_aead_tmpl(crypto_aead_reqtfm(req));
b152c1b17bb6ad Thara Gopinath 2021-04-19  425   struct qce_device *qce = 
tmpl->qce;
b152c1b17bb6ad Thara Gopinath 2021-04-19  426   u32 
enckey[QCE_MAX_CIPHER_KEY_SIZE / sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  427   u32 enciv[QCE_MAX_IV_SIZE / 
sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  428   u32 
authkey[QCE_SHA_HMAC_KEY_SIZE / sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  429   u32 authiv[SHA256_DIGEST_SIZE / 
sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  430   u32 authnonce[QCE_MAX_NONCE / 
sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  431   unsigned int enc_keylen = 
ctx->enc_keylen;
b152c1b17bb6ad Thara Gopinath 2021-04-19  432   unsigned int auth_keylen = 
ctx->auth_keylen;
b152c1b17bb6ad Thara Gopinath 2021-04-19  433   unsigned int enc_ivsize = 
rctx->ivsize;
b152c1b17bb6ad Thara Gopinath 2021-04-19  434   unsigned int auth_ivsize;
b152c1b17bb6ad Thara Gopinath 2021-04-19  435   unsigned int enckey_words, 
enciv_words;
b152c1b17bb6ad Thara Gopinath 2021-04-19  436   unsigned int authkey_words, 
authiv_words, authnonce_words;
b152c1b17bb6ad Thara Gopinath 2021-04-19  437   unsigned long flags = 
rctx->flags;
b152c1b17bb6ad Thara Gopinath 2021-04-19  438   u32 encr_cfg, auth_cfg, config, 
totallen;
b152c1b17bb6ad Thara Gopinath 2021-04-19  439   u32 iv_last_word;
b152c1b17bb6ad Thara Gopinath 2021-04-19  440  
b152c1b17bb6ad Thara Gopinath 2021-04-19  441   qce_setup_config(qce);
b152c1b17bb6ad Thara Gopinath 2021-04-19  442  
b152c1b17bb6ad Thara Gopinath 2021-04-19  443   /* Write encryption key */
b152c1b17bb6ad Thara Gopinath 2021-04-19  444   enckey_words = 
qce_be32_to_cpu_array(enckey, ctx->enc_key, enc_keylen);
b152c1b17bb6ad Thara Gopinath 2021-04-19  445   qce_write_array(qce, 
REG_ENCR_KEY0, enckey, enckey_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19  446  
b152c1b17bb6ad Thara Gopinath 2021-04-19  447   /* Write encryption iv */
b152c1b17bb6ad Thara Gopinath 2021-04-19  448   enciv_words = 
qce_be32_to_cpu_array(enciv, rctx->iv, enc_ivsize);
b152c1b17bb6ad Thara Gopinath 2021-04-19  449   qce_write_array(qce, 
REG_CNTR0_IV0, enciv, enciv_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19  450  
b152c1b17bb6ad Thara Gopinath 2021-04-19  451   if (IS_CCM(rctx->flags)) {
b152c1b17bb6ad Thara Gopinath 2021-04-19  452   iv_last_word = 
enciv[enciv_words - 1];
b152c1b17bb6ad Thara Gopinath 2021-04-19  453   qce_write(qce, 
REG_CNTR3_IV3, iv_last_word + 1);
b152c1b17bb6ad Thara Gopinath 2021-04-19  454   qce_write_array(qce, 
REG_ENCR_CCM_INT_CNTR0, (u32 *)enciv, enciv_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19  455   qce_write(qce, 
REG_CNTR_MASK, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19  456   qce_write(qce, 
REG_CNTR_MASK0, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19  457   qce_write(qce, 
REG_CNTR_MASK1, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19  458   qce_write(qce, 
REG_CNTR_MASK2, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19  459   }
b152c1b17bb6ad Thara Gopinath 2021-04-19  460  
b152c1b17bb6ad Thara Gopinath 2021-04-19  461   /* Clear authentication IV and 
KEY registers of previous values */
b152c1b17bb6ad Thara Gopinath 2021-04-19  462   qce_clear_array(qce, 
REG_AUTH_IV0, 16);
b152c1b17bb6ad Thara Gopinath 2021-04-19  463   qce_clear_array(qce, 
REG_AUTH_KEY0, 16);
b152c1b17bb6ad Thara Gopinath 2021-04-19  464  
b152c1b17bb6ad Thara Gopinath 2021-04-19  465   /* Clear byte count */
b152c1b17bb6ad Thara Gopinath 2021-04-19  466   qce_clear_array(qce, 
REG_AUTH_BYTECNT0, 4);
b152c1b17bb6ad Thara Gopinath 2021-04-19  467  
b152c1b17bb6ad Thara Gopinath 2021-04-19  468   /* Write authentication 

[kbuild] Re: [Patch v3 6/7] crypto: qce: common: Add support for AEAD algorithms

2021-04-28 Thread kernel test robot
CC: kbuild-...@lists.01.org
In-Reply-To: <20210420033602.1729947-7-thara.gopin...@linaro.org>
References: <20210420033602.1729947-7-thara.gopin...@linaro.org>
TO: Thara Gopinath 
TO: herb...@gondor.apana.org.au
TO: da...@davemloft.net
TO: bjorn.anders...@linaro.org
CC: ebigg...@google.com
CC: a...@kernel.org
CC: sivap...@codeaurora.org
CC: linux-cry...@vger.kernel.org
CC: linux-ker...@vger.kernel.org
CC: linux-arm-...@vger.kernel.org

Hi Thara,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on cryptodev/master]
[also build test WARNING on crypto/master next-20210428]
[cannot apply to sparc-next/master v5.12]
[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]

url:
https://github.com/0day-ci/linux/commits/Thara-Gopinath/Add-support-for-AEAD-algorithms-in-Qualcomm-Crypto-Engine-driver/20210420-113944
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
:: branch date: 9 days ago
:: commit date: 9 days ago
config: arm-randconfig-m031-20210428 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/crypto/qce/common.c:482 qce_setup_regs_aead() error: uninitialized 
symbol 'auth_ivsize'.

vim +/auth_ivsize +482 drivers/crypto/qce/common.c

b152c1b17bb6ad Thara Gopinath 2021-04-19  418  
b152c1b17bb6ad Thara Gopinath 2021-04-19  419  static int 
qce_setup_regs_aead(struct crypto_async_request *async_req)
b152c1b17bb6ad Thara Gopinath 2021-04-19  420  {
b152c1b17bb6ad Thara Gopinath 2021-04-19  421   struct aead_request *req = 
aead_request_cast(async_req);
b152c1b17bb6ad Thara Gopinath 2021-04-19  422   struct qce_aead_reqctx *rctx = 
aead_request_ctx(req);
b152c1b17bb6ad Thara Gopinath 2021-04-19  423   struct qce_aead_ctx *ctx = 
crypto_tfm_ctx(async_req->tfm);
b152c1b17bb6ad Thara Gopinath 2021-04-19  424   struct qce_alg_template *tmpl = 
to_aead_tmpl(crypto_aead_reqtfm(req));
b152c1b17bb6ad Thara Gopinath 2021-04-19  425   struct qce_device *qce = 
tmpl->qce;
b152c1b17bb6ad Thara Gopinath 2021-04-19  426   u32 
enckey[QCE_MAX_CIPHER_KEY_SIZE / sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  427   u32 enciv[QCE_MAX_IV_SIZE / 
sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  428   u32 
authkey[QCE_SHA_HMAC_KEY_SIZE / sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  429   u32 authiv[SHA256_DIGEST_SIZE / 
sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  430   u32 authnonce[QCE_MAX_NONCE / 
sizeof(u32)] = {0};
b152c1b17bb6ad Thara Gopinath 2021-04-19  431   unsigned int enc_keylen = 
ctx->enc_keylen;
b152c1b17bb6ad Thara Gopinath 2021-04-19  432   unsigned int auth_keylen = 
ctx->auth_keylen;
b152c1b17bb6ad Thara Gopinath 2021-04-19  433   unsigned int enc_ivsize = 
rctx->ivsize;
b152c1b17bb6ad Thara Gopinath 2021-04-19  434   unsigned int auth_ivsize;
b152c1b17bb6ad Thara Gopinath 2021-04-19  435   unsigned int enckey_words, 
enciv_words;
b152c1b17bb6ad Thara Gopinath 2021-04-19  436   unsigned int authkey_words, 
authiv_words, authnonce_words;
b152c1b17bb6ad Thara Gopinath 2021-04-19  437   unsigned long flags = 
rctx->flags;
b152c1b17bb6ad Thara Gopinath 2021-04-19  438   u32 encr_cfg, auth_cfg, config, 
totallen;
b152c1b17bb6ad Thara Gopinath 2021-04-19  439   u32 iv_last_word;
b152c1b17bb6ad Thara Gopinath 2021-04-19  440  
b152c1b17bb6ad Thara Gopinath 2021-04-19  441   qce_setup_config(qce);
b152c1b17bb6ad Thara Gopinath 2021-04-19  442  
b152c1b17bb6ad Thara Gopinath 2021-04-19  443   /* Write encryption key */
b152c1b17bb6ad Thara Gopinath 2021-04-19  444   enckey_words = 
qce_be32_to_cpu_array(enckey, ctx->enc_key, enc_keylen);
b152c1b17bb6ad Thara Gopinath 2021-04-19  445   qce_write_array(qce, 
REG_ENCR_KEY0, enckey, enckey_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19  446  
b152c1b17bb6ad Thara Gopinath 2021-04-19  447   /* Write encryption iv */
b152c1b17bb6ad Thara Gopinath 2021-04-19  448   enciv_words = 
qce_be32_to_cpu_array(enciv, rctx->iv, enc_ivsize);
b152c1b17bb6ad Thara Gopinath 2021-04-19  449   qce_write_array(qce, 
REG_CNTR0_IV0, enciv, enciv_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19  450  
b152c1b17bb6ad Thara Gopinath 2021-04-19  451   if (IS_CCM(rctx->flags)) {
b152c1b17bb6ad Thara Gopinath 2021-04-19  452   iv_last_word = 
enciv[enciv_words - 1];
b152c1b17bb6ad Thara Gopinath 2021-04-19  453   qce_write(qce, 
REG_CNTR3_IV3, iv_last_word + 1);
b152c1b17bb6ad Thara Gopinath 2021-04-19  454   qce_write_array(qce, 
REG_ENCR_CCM_INT_CNTR0, (u32 *)enciv, enciv_words);
b152c1b17bb6ad Thara Gopinath 2021-04-19  455   qce_write(qce, 
REG_CNTR_MASK, ~0);
b152c1b17bb6ad Thara Gopinath 2021-04-19  456   qce_write(qce,