[hare-scsi-devel:tls-upcall.v4 141/156] drivers/nvme/host/tcp.c:674:7: warning: variable 'map' is uninitialized when used here

From: kernel test robot
Date: Sun Mar 13 2022 - 08:02:06 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git tls-upcall.v4
head: d2416ecdb6b03fc2e4aa40b20cdf919322713224
commit: fb16aba001d4b403be727c8dd379da6e3dbf56e4 [141/156] nvme-tcp: decode c2h term PDU
config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20220313/202203131914.rJjnMLih-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0467eb2cb7654c15ae366967ef35093c5724c416)
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
# https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=fb16aba001d4b403be727c8dd379da6e3dbf56e4
git remote add hare-scsi-devel https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
git fetch --no-tags hare-scsi-devel tls-upcall.v4
git checkout fb16aba001d4b403be727c8dd379da6e3dbf56e4
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/nvme/host/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/nvme/host/tcp.c:674:7: warning: variable 'map' is uninitialized when used here [-Wuninitialized]
if (map[i].fes == pdu->fes) {
^~~
drivers/nvme/host/tcp.c:668:28: note: initialize the variable 'map' to silence this warning
struct fes_status_map *map;
^
= NULL
1 warning generated.


vim +/map +674 drivers/nvme/host/tcp.c

663
664 static int nvme_tcp_handle_c2h_term(struct nvme_tcp_queue *queue,
665 struct nvme_tcp_term_pdu *pdu)
666 {
667 struct nvme_tcp_hdr *ref_pdu;
668 struct fes_status_map *map;
669 const char *fes_desc = NULL;
670 int i;
671 u32 pdu_offset;
672
673 for (i = 0; i < ARRAY_SIZE(fes_status); i++) {
> 674 if (map[i].fes == pdu->fes) {
675 fes_desc = map[i].desc;
676 break;
677 }
678 }
679 if (!fes_desc)
680 fes_desc = "unknown fatal error status";
681
682 if (pdu->hdr.plen > sizeof(struct nvme_tcp_term_pdu))
683 ref_pdu = (struct nvme_tcp_hdr *)((u8 *)pdu + 1);
684
685 if (pdu->fes == NVME_TCP_FES_INVALID_PDU_HDR ||
686 pdu->fes == NVME_TCP_FES_HDR_DIGEST_ERR ||
687 pdu->fes == NVME_TCP_FES_UNSUPPORTED_PARAM) {
688 pdu_offset = le32_to_cpu(pdu->fei);
689
690 dev_err(queue->ctrl->ctrl.device,
691 "queue %d c2h term, %s, pdu type %u offset %u\n",
692 nvme_tcp_queue_id(queue), fes_desc, ref_pdu->type, pdu_offset);
693 } else
694 dev_err(queue->ctrl->ctrl.device,
695 "queue %d c2h term, %s, pdu type %u\n",
696 nvme_tcp_queue_id(queue), fes_desc, ref_pdu->type);
697
698 return -ECONNRESET;
699 }
700

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx