[<prev] [next>] [day] [month] [year] [list]
Message-ID: <69bcc1c1-5690-1d23-e811-4a7393a76c27@intel.com>
Date: Thu, 27 Jan 2022 11:03:53 +0800
From: kernel test robot <yujie.liu@...el.com>
To: farah kassabri <fkassabri@...ana.ai>
CC: <llvm@...ts.linux.dev>, <kbuild-all@...ts.01.org>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
Oded Gabbay <ogabbay@...nel.org>
Subject: drivers/misc/habanalabs/common/command_buffer.c:472:24: warning:
Assigned value is garbage or undefined
[clang-analyzer-core.uninitialized.Assign]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
commit: b9d31cada7d9f137028c11534fff77fec8511690 habanalabs: change wait_for_interrupt implementation
date: 4 weeks ago
config: riscv-randconfig-c006-20220124 (https://download.01.org/0day-ci/archive/20220124/202201242342.1CK6hoP8-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 9006bf424847bf91f0a624ffc27ad165c7b804c4)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b9d31cada7d9f137028c11534fff77fec8511690
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout b9d31cada7d9f137028c11534fff77fec8511690
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
clang-analyzer warnings: (new ones prefixed by >>)
>> drivers/misc/habanalabs/common/command_buffer.c:472:24: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
args->out.device_va = device_va;
^ ~~~~~~~~~
drivers/misc/habanalabs/common/command_buffer.c:429:18: note: 'device_va' declared without an initial value
u64 handle = 0, device_va;
^~~~~~~~~
drivers/misc/habanalabs/common/command_buffer.c:464:8: note: Calling 'hl_cb_info'
rc = hl_cb_info(hdev, &hpriv->cb_mgr, args->in.cb_handle,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/misc/habanalabs/common/command_buffer.c:399:6: note: Assuming 'cb' is null
if (!cb) {
^~~
drivers/misc/habanalabs/common/command_buffer.c:399:2: note: Taking true branch
if (!cb) {
^
drivers/misc/habanalabs/common/command_buffer.c:400:3: note: Loop condition is false. Exiting loop
dev_err(hdev->dev,
^
drivers/misc/habanalabs/common/command_buffer.c:403:3: note: Control jumps to line 420
goto out;
^
drivers/misc/habanalabs/common/command_buffer.c:421:2: note: Returning without writing to '*device_va'
return rc;
^
drivers/misc/habanalabs/common/command_buffer.c:464:8: note: Returning from 'hl_cb_info'
rc = hl_cb_info(hdev, &hpriv->cb_mgr, args->in.cb_handle,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/misc/habanalabs/common/command_buffer.c:471:7: note: Assuming the condition is true
if (args->in.flags & HL_CB_FLAGS_GET_DEVICE_VA)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/misc/habanalabs/common/command_buffer.c:471:3: note: Taking true branch
if (args->in.flags & HL_CB_FLAGS_GET_DEVICE_VA)
^
drivers/misc/habanalabs/common/command_buffer.c:472:24: note: Assigned value is garbage or undefined
args->out.device_va = device_va;
^ ~~~~~~~~~
vim +472 drivers/misc/habanalabs/common/command_buffer.c
f44afb5b5a5d04 drivers/misc/habanalabs/common/command_buffer.c Tomer Tayar 2020-09-02 423
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 424 int hl_cb_ioctl(struct hl_fpriv *hpriv, void *data)
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 425 {
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 426 union hl_cb_args *args = data;
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 427 struct hl_device *hdev = hpriv->hdev;
66a76401c50b26 drivers/misc/habanalabs/common/command_buffer.c Ofir Bitton 2020-10-05 428 enum hl_device_status status;
b9d31cada7d9f1 drivers/misc/habanalabs/common/command_buffer.c farah kassabri 2021-11-02 429 u64 handle = 0, device_va;
f44afb5b5a5d04 drivers/misc/habanalabs/common/command_buffer.c Tomer Tayar 2020-09-02 430 u32 usage_cnt = 0;
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 431 int rc;
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 432
66a76401c50b26 drivers/misc/habanalabs/common/command_buffer.c Ofir Bitton 2020-10-05 433 if (!hl_device_operational(hdev, &status)) {
3f5398cfbf051d drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-04-06 434 dev_warn_ratelimited(hdev->dev,
3f5398cfbf051d drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-04-06 435 "Device is %s. Can't execute CB IOCTL\n",
66a76401c50b26 drivers/misc/habanalabs/common/command_buffer.c Ofir Bitton 2020-10-05 436 hdev->status[status]);
3f5398cfbf051d drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-04-06 437 return -EBUSY;
3f5398cfbf051d drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-04-06 438 }
3f5398cfbf051d drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-04-06 439
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 440 switch (args->in.op) {
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 441 case HL_CB_OP_CREATE:
39b425170d35ff drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2020-04-17 442 if (args->in.cb_size > HL_MAX_CB_SIZE) {
39b425170d35ff drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2020-04-17 443 dev_err(hdev->dev,
39b425170d35ff drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2020-04-17 444 "User requested CB size %d must be less than %d\n",
39b425170d35ff drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2020-04-17 445 args->in.cb_size, HL_MAX_CB_SIZE);
39b425170d35ff drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2020-04-17 446 rc = -EINVAL;
39b425170d35ff drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2020-04-17 447 } else {
fa8641a14f2841 drivers/misc/habanalabs/common/command_buffer.c Tomer Tayar 2020-09-07 448 rc = hl_cb_create(hdev, &hpriv->cb_mgr, hpriv->ctx,
ef6a0f6caa4a5d drivers/misc/habanalabs/common/command_buffer.c Tomer Tayar 2020-07-09 449 args->in.cb_size, false,
ef6a0f6caa4a5d drivers/misc/habanalabs/common/command_buffer.c Tomer Tayar 2020-07-09 450 !!(args->in.flags & HL_CB_FLAGS_MAP),
ef6a0f6caa4a5d drivers/misc/habanalabs/common/command_buffer.c Tomer Tayar 2020-07-09 451 &handle);
39b425170d35ff drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2020-04-17 452 }
39b425170d35ff drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2020-04-17 453
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 454 memset(args, 0, sizeof(*args));
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 455 args->out.cb_handle = handle;
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 456 break;
39b425170d35ff drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2020-04-17 457
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 458 case HL_CB_OP_DESTROY:
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 459 rc = hl_cb_destroy(hdev, &hpriv->cb_mgr,
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 460 args->in.cb_handle);
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 461 break;
39b425170d35ff drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2020-04-17 462
f44afb5b5a5d04 drivers/misc/habanalabs/common/command_buffer.c Tomer Tayar 2020-09-02 463 case HL_CB_OP_INFO:
f44afb5b5a5d04 drivers/misc/habanalabs/common/command_buffer.c Tomer Tayar 2020-09-02 464 rc = hl_cb_info(hdev, &hpriv->cb_mgr, args->in.cb_handle,
b9d31cada7d9f1 drivers/misc/habanalabs/common/command_buffer.c farah kassabri 2021-11-02 465 args->in.flags,
b9d31cada7d9f1 drivers/misc/habanalabs/common/command_buffer.c farah kassabri 2021-11-02 466 &usage_cnt,
b9d31cada7d9f1 drivers/misc/habanalabs/common/command_buffer.c farah kassabri 2021-11-02 467 &device_va);
b9d31cada7d9f1 drivers/misc/habanalabs/common/command_buffer.c farah kassabri 2021-11-02 468
b9d31cada7d9f1 drivers/misc/habanalabs/common/command_buffer.c farah kassabri 2021-11-02 469 memset(&args->out, 0, sizeof(args->out));
b9d31cada7d9f1 drivers/misc/habanalabs/common/command_buffer.c farah kassabri 2021-11-02 470
b9d31cada7d9f1 drivers/misc/habanalabs/common/command_buffer.c farah kassabri 2021-11-02 471 if (args->in.flags & HL_CB_FLAGS_GET_DEVICE_VA)
b9d31cada7d9f1 drivers/misc/habanalabs/common/command_buffer.c farah kassabri 2021-11-02 @472 args->out.device_va = device_va;
b9d31cada7d9f1 drivers/misc/habanalabs/common/command_buffer.c farah kassabri 2021-11-02 473 else
f44afb5b5a5d04 drivers/misc/habanalabs/common/command_buffer.c Tomer Tayar 2020-09-02 474 args->out.usage_cnt = usage_cnt;
f44afb5b5a5d04 drivers/misc/habanalabs/common/command_buffer.c Tomer Tayar 2020-09-02 475 break;
f44afb5b5a5d04 drivers/misc/habanalabs/common/command_buffer.c Tomer Tayar 2020-09-02 476
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 477 default:
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 478 rc = -ENOTTY;
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 479 break;
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 480 }
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 481
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 482 return rc;
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 483 }
be5d926b5c1043 drivers/misc/habanalabs/command_buffer.c Oded Gabbay 2019-02-16 484
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Powered by blists - more mailing lists