From: kernel test robot <lkp@intel.com>
To: Christoph Hellwig <hch@lst.de>
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
linux-nvme@lists.infradead.org, Keith Busch <kbusch@kernel.org>,
Sagi Grimberg <sagi@grimberg.me>, Hannes Reinecke <hare@suse.de>
Subject: [linux-nvme:nvme-5.13 4/4] drivers/nvme/host/multipath.c:810:6: warning: variable 'error' is used uninitialized whenever 'if' condition is true
Date: Mon, 10 May 2021 19:36:12 +0800 [thread overview]
Message-ID: <202105101909.BcZxRsbs-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3625 bytes --]
tree: git://git.infradead.org/nvme.git nvme-5.13
head: 8b951d3a91bdd748db10df3ad020257e49dd97b0
commit: 8b951d3a91bdd748db10df3ad020257e49dd97b0 [4/4] nvme-multipath: fix double initialization of ANA state
config: x86_64-randconfig-a015-20210510 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 492173d42b32cb91d5d0d72d5ed84fcab80d059a)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git remote add linux-nvme git://git.infradead.org/nvme.git
git fetch --no-tags linux-nvme nvme-5.13
git checkout 8b951d3a91bdd748db10df3ad020257e49dd97b0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/nvme/host/multipath.c:810:6: warning: variable 'error' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (ana_log_size > max_transfer_size) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/nvme/host/multipath.c:832:9: note: uninitialized use occurs here
return error;
^~~~~
drivers/nvme/host/multipath.c:810:2: note: remove the 'if' if its condition is always false
if (ana_log_size > max_transfer_size) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/nvme/host/multipath.c:795:11: note: initialize the variable 'error' to silence this warning
int error;
^
= 0
1 warning generated.
vim +810 drivers/nvme/host/multipath.c
790
791 int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
792 {
793 size_t max_transfer_size = ctrl->max_hw_sectors << SECTOR_SHIFT;
794 size_t ana_log_size;
795 int error;
796
797 /* check if multipath is enabled and we have the capability */
798 if (!multipath || !ctrl->subsys ||
799 !(ctrl->subsys->cmic & NVME_CTRL_CMIC_ANA))
800 return 0;
801
802 ctrl->anacap = id->anacap;
803 ctrl->anatt = id->anatt;
804 ctrl->nanagrpid = le32_to_cpu(id->nanagrpid);
805 ctrl->anagrpmax = le32_to_cpu(id->anagrpmax);
806
807 ana_log_size = sizeof(struct nvme_ana_rsp_hdr) +
808 ctrl->nanagrpid * sizeof(struct nvme_ana_group_desc) +
809 ctrl->max_namespaces * sizeof(__le32);
> 810 if (ana_log_size > max_transfer_size) {
811 dev_err(ctrl->device,
812 "ANA log page size (%zd) larger than MDTS (%zd).\n",
813 ana_log_size, max_transfer_size);
814 dev_err(ctrl->device, "disabling ANA support.\n");
815 goto out_uninit;
816 }
817 if (ana_log_size > ctrl->ana_log_size) {
818 nvme_mpath_stop(ctrl);
819 kfree(ctrl->ana_log_buf);
820 ctrl->ana_log_buf = kmalloc(ctrl->ana_log_size, GFP_KERNEL);
821 if (!ctrl->ana_log_buf)
822 return -ENOMEM;
823 }
824 ctrl->ana_log_size = ana_log_size;
825 error = nvme_read_ana_log(ctrl);
826 if (error)
827 goto out_uninit;
828 return 0;
829
830 out_uninit:
831 nvme_mpath_uninit(ctrl);
832 return error;
833 }
834
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30955 bytes --]
[-- Attachment #3: Type: text/plain, Size: 158 bytes --]
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next reply other threads:[~2021-05-10 11:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-10 11:36 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-05-10 11:43 [linux-nvme:nvme-5.13 4/4] drivers/nvme/host/multipath.c:810:6: warning: variable 'error' is used uninitialized whenever 'if' condition is true 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=202105101909.BcZxRsbs-lkp@intel.com \
--to=lkp@intel.com \
--cc=clang-built-linux@googlegroups.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kbuild-all@lists.01.org \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox