[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210119085530.GI2696@kadam>
Date: Tue, 19 Jan 2021 11:55:30 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: kbuild@...ts.01.org, Manish Rangankar <mrangankar@...vell.com>
Cc: lkp@...el.com, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Lee Duncan <lduncan@...e.com>
Subject: drivers/scsi/qedi/qedi_main.c:924 qedi_get_boot_tgt_info() error:
snprintf() chops off the last chars of 256 vs 255
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0da0a8a0a0e1845f495431c3d8d733d2bbf9e9e5
commit: 2f1ea39870c95aa9fff6a0b48757625a0b22f551 scsi: qedi: Remove additional char from boot target iqnname
config: x86_64-randconfig-m001-20210117 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
New smatch warnings:
drivers/scsi/qedi/qedi_main.c:924 qedi_get_boot_tgt_info() error: snprintf() chops off the last chars of 'block->target[index]->target_name.byte': 256 vs 255
Old smatch warnings:
drivers/scsi/qedi/qedi_main.c:956 qedi_find_boot_info() warn: returning -1 instead of -ENOMEM is sloppy
vim +924 drivers/scsi/qedi/qedi_main.c
534bbdf8832ae484 Manish Rangankar 2018-05-22 916 static void qedi_get_boot_tgt_info(struct nvm_iscsi_block *block,
534bbdf8832ae484 Manish Rangankar 2018-05-22 917 struct qedi_boot_target *tgt, u8 index)
534bbdf8832ae484 Manish Rangankar 2018-05-22 918 {
534bbdf8832ae484 Manish Rangankar 2018-05-22 919 u32 ipv6_en;
534bbdf8832ae484 Manish Rangankar 2018-05-22 920
534bbdf8832ae484 Manish Rangankar 2018-05-22 921 ipv6_en = !!(block->generic.ctrl_flags &
534bbdf8832ae484 Manish Rangankar 2018-05-22 922 NVM_ISCSI_CFG_GEN_IPV6_ENABLED);
534bbdf8832ae484 Manish Rangankar 2018-05-22 923
2f1ea39870c95aa9 Manish Rangankar 2020-04-07 @924 snprintf(tgt->iscsi_name, sizeof(tgt->iscsi_name), "%s",
534bbdf8832ae484 Manish Rangankar 2018-05-22 925 block->target[index].target_name.byte);
tgt->iscsi_name is one char smaller than block->target[index].target_name.byte.
534bbdf8832ae484 Manish Rangankar 2018-05-22 926
534bbdf8832ae484 Manish Rangankar 2018-05-22 927 tgt->ipv6_en = ipv6_en;
534bbdf8832ae484 Manish Rangankar 2018-05-22 928
534bbdf8832ae484 Manish Rangankar 2018-05-22 929 if (ipv6_en)
534bbdf8832ae484 Manish Rangankar 2018-05-22 930 snprintf(tgt->ip_addr, IPV6_LEN, "%pI6\n",
534bbdf8832ae484 Manish Rangankar 2018-05-22 931 block->target[index].ipv6_addr.byte);
534bbdf8832ae484 Manish Rangankar 2018-05-22 932 else
534bbdf8832ae484 Manish Rangankar 2018-05-22 933 snprintf(tgt->ip_addr, IPV4_LEN, "%pI4\n",
534bbdf8832ae484 Manish Rangankar 2018-05-22 934 block->target[index].ipv4_addr.byte);
534bbdf8832ae484 Manish Rangankar 2018-05-22 935 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (32228 bytes)
Powered by blists - more mailing lists