From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: drivers/crypto/aspeed/aspeed-acry.c:295 aspeed_acry_rsa_ctx_copy() error: uninitialized symbol 'idx'.
Date: Fri, 10 Mar 2023 18:22:51 +0800 [thread overview]
Message-ID: <202303101834.h63W0sgT-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Neal Liu <neal_liu@aspeedtech.com>
CC: Herbert Xu <herbert@gondor.apana.org.au>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 44889ba56cbb3d51154660ccd15818bc77276696
commit: 2f1cf4e50c956f882c9fc209c7cded832b67b8a3 crypto: aspeed - Add ACRY RSA driver
date: 8 weeks ago
:::::: branch date: 15 hours ago
:::::: commit date: 8 weeks ago
config: m68k-randconfig-m041-20230310 (https://download.01.org/0day-ci/archive/20230310/202303101834.h63W0sgT-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Link: https://lore.kernel.org/r/202303101834.h63W0sgT-lkp@intel.com/
smatch warnings:
drivers/crypto/aspeed/aspeed-acry.c:295 aspeed_acry_rsa_ctx_copy() error: uninitialized symbol 'idx'.
vim +/idx +295 drivers/crypto/aspeed/aspeed-acry.c
2f1cf4e50c956f Neal Liu 2023-01-04 236
2f1cf4e50c956f Neal Liu 2023-01-04 237 /*
2f1cf4e50c956f Neal Liu 2023-01-04 238 * Copy Exp/Mod to DMA buffer for engine used.
2f1cf4e50c956f Neal Liu 2023-01-04 239 *
2f1cf4e50c956f Neal Liu 2023-01-04 240 * Params:
2f1cf4e50c956f Neal Liu 2023-01-04 241 * - mode 0 : Exponential
2f1cf4e50c956f Neal Liu 2023-01-04 242 * - mode 1 : Modulus
2f1cf4e50c956f Neal Liu 2023-01-04 243 *
2f1cf4e50c956f Neal Liu 2023-01-04 244 * Example:
2f1cf4e50c956f Neal Liu 2023-01-04 245 * - DRAM memory layout:
2f1cf4e50c956f Neal Liu 2023-01-04 246 * D[0], D[4], D[8], D[12]
2f1cf4e50c956f Neal Liu 2023-01-04 247 * - ACRY SRAM memory layout should reverse the order of source data:
2f1cf4e50c956f Neal Liu 2023-01-04 248 * D[12], D[8], D[4], D[0]
2f1cf4e50c956f Neal Liu 2023-01-04 249 */
2f1cf4e50c956f Neal Liu 2023-01-04 250 static int aspeed_acry_rsa_ctx_copy(struct aspeed_acry_dev *acry_dev, void *buf,
2f1cf4e50c956f Neal Liu 2023-01-04 251 const void *xbuf, size_t nbytes,
2f1cf4e50c956f Neal Liu 2023-01-04 252 enum aspeed_rsa_key_mode mode)
2f1cf4e50c956f Neal Liu 2023-01-04 253 {
2f1cf4e50c956f Neal Liu 2023-01-04 254 const u8 *src = xbuf;
2f1cf4e50c956f Neal Liu 2023-01-04 255 u32 *dw_buf = (u32 *)buf;
2f1cf4e50c956f Neal Liu 2023-01-04 256 int nbits, ndw;
2f1cf4e50c956f Neal Liu 2023-01-04 257 int i, j, idx;
2f1cf4e50c956f Neal Liu 2023-01-04 258 u32 data = 0;
2f1cf4e50c956f Neal Liu 2023-01-04 259
2f1cf4e50c956f Neal Liu 2023-01-04 260 ACRY_DBG(acry_dev, "nbytes:%zu, mode:%d\n", nbytes, mode);
2f1cf4e50c956f Neal Liu 2023-01-04 261
2f1cf4e50c956f Neal Liu 2023-01-04 262 if (nbytes > ASPEED_ACRY_RSA_MAX_KEY_LEN)
2f1cf4e50c956f Neal Liu 2023-01-04 263 return -ENOMEM;
2f1cf4e50c956f Neal Liu 2023-01-04 264
2f1cf4e50c956f Neal Liu 2023-01-04 265 /* Remove the leading zeros */
2f1cf4e50c956f Neal Liu 2023-01-04 266 while (nbytes > 0 && src[0] == 0) {
2f1cf4e50c956f Neal Liu 2023-01-04 267 src++;
2f1cf4e50c956f Neal Liu 2023-01-04 268 nbytes--;
2f1cf4e50c956f Neal Liu 2023-01-04 269 }
2f1cf4e50c956f Neal Liu 2023-01-04 270
2f1cf4e50c956f Neal Liu 2023-01-04 271 nbits = nbytes * 8;
2f1cf4e50c956f Neal Liu 2023-01-04 272 if (nbytes > 0)
2f1cf4e50c956f Neal Liu 2023-01-04 273 nbits -= count_leading_zeros(src[0]) - (BITS_PER_LONG - 8);
2f1cf4e50c956f Neal Liu 2023-01-04 274
2f1cf4e50c956f Neal Liu 2023-01-04 275 /* double-world alignment */
2f1cf4e50c956f Neal Liu 2023-01-04 276 ndw = DIV_ROUND_UP(nbytes, BYTES_PER_DWORD);
2f1cf4e50c956f Neal Liu 2023-01-04 277
2f1cf4e50c956f Neal Liu 2023-01-04 278 if (nbytes > 0) {
2f1cf4e50c956f Neal Liu 2023-01-04 279 i = BYTES_PER_DWORD - nbytes % BYTES_PER_DWORD;
2f1cf4e50c956f Neal Liu 2023-01-04 280 i %= BYTES_PER_DWORD;
2f1cf4e50c956f Neal Liu 2023-01-04 281
2f1cf4e50c956f Neal Liu 2023-01-04 282 for (j = ndw; j > 0; j--) {
2f1cf4e50c956f Neal Liu 2023-01-04 283 for (; i < BYTES_PER_DWORD; i++) {
2f1cf4e50c956f Neal Liu 2023-01-04 284 data <<= 8;
2f1cf4e50c956f Neal Liu 2023-01-04 285 data |= *src++;
2f1cf4e50c956f Neal Liu 2023-01-04 286 }
2f1cf4e50c956f Neal Liu 2023-01-04 287
2f1cf4e50c956f Neal Liu 2023-01-04 288 i = 0;
2f1cf4e50c956f Neal Liu 2023-01-04 289
2f1cf4e50c956f Neal Liu 2023-01-04 290 if (mode == ASPEED_RSA_EXP_MODE)
2f1cf4e50c956f Neal Liu 2023-01-04 291 idx = acry_dev->exp_dw_mapping[j - 1];
2f1cf4e50c956f Neal Liu 2023-01-04 292 else if (mode == ASPEED_RSA_MOD_MODE)
2f1cf4e50c956f Neal Liu 2023-01-04 293 idx = acry_dev->mod_dw_mapping[j - 1];
2f1cf4e50c956f Neal Liu 2023-01-04 294
2f1cf4e50c956f Neal Liu 2023-01-04 @295 dw_buf[idx] = cpu_to_le32(data);
2f1cf4e50c956f Neal Liu 2023-01-04 296 }
2f1cf4e50c956f Neal Liu 2023-01-04 297 }
2f1cf4e50c956f Neal Liu 2023-01-04 298
2f1cf4e50c956f Neal Liu 2023-01-04 299 return nbits;
2f1cf4e50c956f Neal Liu 2023-01-04 300 }
2f1cf4e50c956f Neal Liu 2023-01-04 301
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
next reply other threads:[~2023-03-10 10:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 10:22 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-02-27 4:31 drivers/crypto/aspeed/aspeed-acry.c:295 aspeed_acry_rsa_ctx_copy() error: uninitialized symbol 'idx' Dan Carpenter
2023-02-27 4:31 ` Dan Carpenter
2023-02-26 2:54 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202303101834.h63W0sgT-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.