All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Manish Rangankar <mrangankar@marvell.com>
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>,
	kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Lee Duncan <lduncan@suse.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
Date: Tue, 5 Jan 2021 16:41:24 +0300	[thread overview]
Message-ID: <20210105134124.GE2809@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 2680 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   139711f033f636cc78b6aaf7363252241b9698ef
commit: 2f1ea39870c95aa9fff6a0b48757625a0b22f551 scsi: qedi: Remove additional char from boot target iqnname
config: i386-randconfig-m021-20201230 (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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.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
drivers/scsi/qedi/qedi_main.c:1607 qedi_alloc_global_queues() warn: missing error code 'status'

vim +924 drivers/scsi/qedi/qedi_main.c

534bbdf8832ae48 Manish Rangankar 2018-05-22  916  static void qedi_get_boot_tgt_info(struct nvm_iscsi_block *block,
534bbdf8832ae48 Manish Rangankar 2018-05-22  917  				   struct qedi_boot_target *tgt, u8 index)
534bbdf8832ae48 Manish Rangankar 2018-05-22  918  {
534bbdf8832ae48 Manish Rangankar 2018-05-22  919  	u32 ipv6_en;
534bbdf8832ae48 Manish Rangankar 2018-05-22  920  
534bbdf8832ae48 Manish Rangankar 2018-05-22  921  	ipv6_en = !!(block->generic.ctrl_flags &
534bbdf8832ae48 Manish Rangankar 2018-05-22  922  		     NVM_ISCSI_CFG_GEN_IPV6_ENABLED);
534bbdf8832ae48 Manish Rangankar 2018-05-22  923  
2f1ea39870c95aa Manish Rangankar 2020-04-07 @924  	snprintf(tgt->iscsi_name, sizeof(tgt->iscsi_name), "%s",
534bbdf8832ae48 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.

534bbdf8832ae48 Manish Rangankar 2018-05-22  926  
534bbdf8832ae48 Manish Rangankar 2018-05-22  927  	tgt->ipv6_en = ipv6_en;
534bbdf8832ae48 Manish Rangankar 2018-05-22  928  
534bbdf8832ae48 Manish Rangankar 2018-05-22  929  	if (ipv6_en)
534bbdf8832ae48 Manish Rangankar 2018-05-22  930  		snprintf(tgt->ip_addr, IPV6_LEN, "%pI6\n",
534bbdf8832ae48 Manish Rangankar 2018-05-22  931  			 block->target[index].ipv6_addr.byte);
534bbdf8832ae48 Manish Rangankar 2018-05-22  932  	else
534bbdf8832ae48 Manish Rangankar 2018-05-22  933  		snprintf(tgt->ip_addr, IPV4_LEN, "%pI4\n",
534bbdf8832ae48 Manish Rangankar 2018-05-22  934  			 block->target[index].ipv4_addr.byte);
534bbdf8832ae48 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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38242 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: drivers/scsi/qedi/qedi_main.c:924 qedi_get_boot_tgt_info() error: snprintf() chops off the last chars of 256 vs 255
Date: Tue, 05 Jan 2021 16:41:24 +0300	[thread overview]
Message-ID: <20210105134124.GE2809@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 2728 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   139711f033f636cc78b6aaf7363252241b9698ef
commit: 2f1ea39870c95aa9fff6a0b48757625a0b22f551 scsi: qedi: Remove additional char from boot target iqnname
config: i386-randconfig-m021-20201230 (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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.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
drivers/scsi/qedi/qedi_main.c:1607 qedi_alloc_global_queues() warn: missing error code 'status'

vim +924 drivers/scsi/qedi/qedi_main.c

534bbdf8832ae48 Manish Rangankar 2018-05-22  916  static void qedi_get_boot_tgt_info(struct nvm_iscsi_block *block,
534bbdf8832ae48 Manish Rangankar 2018-05-22  917  				   struct qedi_boot_target *tgt, u8 index)
534bbdf8832ae48 Manish Rangankar 2018-05-22  918  {
534bbdf8832ae48 Manish Rangankar 2018-05-22  919  	u32 ipv6_en;
534bbdf8832ae48 Manish Rangankar 2018-05-22  920  
534bbdf8832ae48 Manish Rangankar 2018-05-22  921  	ipv6_en = !!(block->generic.ctrl_flags &
534bbdf8832ae48 Manish Rangankar 2018-05-22  922  		     NVM_ISCSI_CFG_GEN_IPV6_ENABLED);
534bbdf8832ae48 Manish Rangankar 2018-05-22  923  
2f1ea39870c95aa Manish Rangankar 2020-04-07 @924  	snprintf(tgt->iscsi_name, sizeof(tgt->iscsi_name), "%s",
534bbdf8832ae48 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.

534bbdf8832ae48 Manish Rangankar 2018-05-22  926  
534bbdf8832ae48 Manish Rangankar 2018-05-22  927  	tgt->ipv6_en = ipv6_en;
534bbdf8832ae48 Manish Rangankar 2018-05-22  928  
534bbdf8832ae48 Manish Rangankar 2018-05-22  929  	if (ipv6_en)
534bbdf8832ae48 Manish Rangankar 2018-05-22  930  		snprintf(tgt->ip_addr, IPV6_LEN, "%pI6\n",
534bbdf8832ae48 Manish Rangankar 2018-05-22  931  			 block->target[index].ipv6_addr.byte);
534bbdf8832ae48 Manish Rangankar 2018-05-22  932  	else
534bbdf8832ae48 Manish Rangankar 2018-05-22  933  		snprintf(tgt->ip_addr, IPV4_LEN, "%pI4\n",
534bbdf8832ae48 Manish Rangankar 2018-05-22  934  			 block->target[index].ipv4_addr.byte);
534bbdf8832ae48 Manish Rangankar 2018-05-22  935  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38242 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: drivers/scsi/qedi/qedi_main.c:924 qedi_get_boot_tgt_info() error: snprintf() chops off the last chars of 256 vs 255
Date: Tue, 05 Jan 2021 16:41:24 +0300	[thread overview]
Message-ID: <20210105134124.GE2809@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 2728 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   139711f033f636cc78b6aaf7363252241b9698ef
commit: 2f1ea39870c95aa9fff6a0b48757625a0b22f551 scsi: qedi: Remove additional char from boot target iqnname
config: i386-randconfig-m021-20201230 (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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.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
drivers/scsi/qedi/qedi_main.c:1607 qedi_alloc_global_queues() warn: missing error code 'status'

vim +924 drivers/scsi/qedi/qedi_main.c

534bbdf8832ae48 Manish Rangankar 2018-05-22  916  static void qedi_get_boot_tgt_info(struct nvm_iscsi_block *block,
534bbdf8832ae48 Manish Rangankar 2018-05-22  917  				   struct qedi_boot_target *tgt, u8 index)
534bbdf8832ae48 Manish Rangankar 2018-05-22  918  {
534bbdf8832ae48 Manish Rangankar 2018-05-22  919  	u32 ipv6_en;
534bbdf8832ae48 Manish Rangankar 2018-05-22  920  
534bbdf8832ae48 Manish Rangankar 2018-05-22  921  	ipv6_en = !!(block->generic.ctrl_flags &
534bbdf8832ae48 Manish Rangankar 2018-05-22  922  		     NVM_ISCSI_CFG_GEN_IPV6_ENABLED);
534bbdf8832ae48 Manish Rangankar 2018-05-22  923  
2f1ea39870c95aa Manish Rangankar 2020-04-07 @924  	snprintf(tgt->iscsi_name, sizeof(tgt->iscsi_name), "%s",
534bbdf8832ae48 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.

534bbdf8832ae48 Manish Rangankar 2018-05-22  926  
534bbdf8832ae48 Manish Rangankar 2018-05-22  927  	tgt->ipv6_en = ipv6_en;
534bbdf8832ae48 Manish Rangankar 2018-05-22  928  
534bbdf8832ae48 Manish Rangankar 2018-05-22  929  	if (ipv6_en)
534bbdf8832ae48 Manish Rangankar 2018-05-22  930  		snprintf(tgt->ip_addr, IPV6_LEN, "%pI6\n",
534bbdf8832ae48 Manish Rangankar 2018-05-22  931  			 block->target[index].ipv6_addr.byte);
534bbdf8832ae48 Manish Rangankar 2018-05-22  932  	else
534bbdf8832ae48 Manish Rangankar 2018-05-22  933  		snprintf(tgt->ip_addr, IPV4_LEN, "%pI4\n",
534bbdf8832ae48 Manish Rangankar 2018-05-22  934  			 block->target[index].ipv4_addr.byte);
534bbdf8832ae48 Manish Rangankar 2018-05-22  935  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38242 bytes --]

             reply	other threads:[~2021-01-05 13:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 13:41 Dan Carpenter [this message]
2021-01-05 13:41 ` drivers/scsi/qedi/qedi_main.c:924 qedi_get_boot_tgt_info() error: snprintf() chops off the last chars of 256 vs 255 Dan Carpenter
2021-01-05 13:41 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2021-01-19  8:55 Dan Carpenter
2021-01-19  8:55 ` Dan Carpenter
2021-01-19  8:55 ` Dan Carpenter
2021-01-17  0:16 kernel test robot
2020-12-30 14:22 kernel test robot
2020-08-29 17:26 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=20210105134124.GE2809@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=error27@gmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=lduncan@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=martin.petersen@oracle.com \
    --cc=mrangankar@marvell.com \
    /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 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.