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: Sun, 26 Feb 2023 10:54:19 +0800 [thread overview] Message-ID: <202302261052.CVFRyq6F-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: 1ec35eadc3b448c91a6b763371a7073444e95f9d commit: 2f1cf4e50c956f882c9fc209c7cded832b67b8a3 crypto: aspeed - Add ACRY RSA driver date: 6 weeks ago :::::: branch date: 4 hours ago :::::: commit date: 6 weeks ago config: m68k-randconfig-m031-20230226 (https://download.01.org/0day-ci/archive/20230226/202302261052.CVFRyq6F-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/202302261052.CVFRyq6F-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
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com> To: oe-kbuild@lists.linux.dev, Neal Liu <neal_liu@aspeedtech.com> Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au> Subject: drivers/crypto/aspeed/aspeed-acry.c:295 aspeed_acry_rsa_ctx_copy() error: uninitialized symbol 'idx'. Date: Mon, 27 Feb 2023 07:31:07 +0300 [thread overview] Message-ID: <202302261052.CVFRyq6F-lkp@intel.com> (raw) Message-ID: <20230227043107.LIU1W11Hyins-etLn5p7wZuCHYgk5Y1ylQ3lhDphwDg@z> (raw) tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 1ec35eadc3b448c91a6b763371a7073444e95f9d commit: 2f1cf4e50c956f882c9fc209c7cded832b67b8a3 crypto: aspeed - Add ACRY RSA driver config: m68k-randconfig-m031-20230226 (https://download.01.org/0day-ci/archive/20230226/202302261052.CVFRyq6F-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/202302261052.CVFRyq6F-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 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]; idx not initialized for if it's not EXPR and not MOD. Just do: } else { /* mode == ASPEED_RSA_MOD_MODE */ 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 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
next reply other threads:[~2023-02-26 2:54 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-26 2:54 kernel test robot [this message] 2023-02-27 4:31 ` drivers/crypto/aspeed/aspeed-acry.c:295 aspeed_acry_rsa_ctx_copy() error: uninitialized symbol 'idx' Dan Carpenter 2023-03-10 10:22 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=202302261052.CVFRyq6F-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: linkBe 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.