diff mbox

[06/25] qla2xxx: Reduce excessive debug print during 27xx fwdump.

Message ID 20170519215344.2168-7-himanshu.madhani@cavium.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Madhani, Himanshu May 19, 2017, 9:53 p.m. UTC
From: Joe Carnuccio <joe.carnuccio@cavium.com>

Retain loop test for fwdump length exceeding buffer length.

Cc: <stable@vger.kernel.org>
Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
 drivers/scsi/qla2xxx/qla_init.c |  8 ++++----
 drivers/scsi/qla2xxx/qla_tmpl.c | 16 +++++++++-------
 2 files changed, 13 insertions(+), 11 deletions(-)

Comments

kernel test robot May 21, 2017, 10:43 a.m. UTC | #1
Hi Joe,

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.12-rc1 next-20170519]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Bug-fixes-and-cleanups/20170521-131406
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/scsi/qla2xxx/qla_init.c: In function 'qla24xx_load_risc_flash':
>> drivers/scsi/qla2xxx/qla_init.c:6359:50: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'uint32_t {aka unsigned int}' [-Wformat=]
          "Failed fwdump template exceeds array by %lx bytes\n",
                                                     ^
   drivers/scsi/qla2xxx/qla_init.c: In function 'qla24xx_load_risc_blob':
   drivers/scsi/qla2xxx/qla_init.c:6661:50: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'uint32_t {aka unsigned int}' [-Wformat=]
          "Failed fwdump template exceeds array by %lx bytes\n",
                                                     ^

vim +6359 drivers/scsi/qla2xxx/qla_init.c

  6343		dcode = ha->fw_dump_template;
  6344		qla24xx_read_flash_data(vha, dcode, faddr, risc_size);
  6345		for (i = 0; i < risc_size; i++)
  6346			dcode[i] = le32_to_cpu(dcode[i]);
  6347	
  6348		if (!qla27xx_fwdt_template_valid(dcode)) {
  6349			ql_log(ql_log_warn, vha, 0x0165,
  6350			    "Failed fwdump template validate\n");
  6351			goto default_template;
  6352		}
  6353	
  6354		dlen = qla27xx_fwdt_template_size(dcode);
  6355		ql_dbg(ql_dbg_init, vha, 0x0166,
  6356		    "-> template size %x bytes\n", dlen);
  6357		if (dlen > risc_size * sizeof(*dcode)) {
  6358			ql_log(ql_log_warn, vha, 0x0167,
> 6359			    "Failed fwdump template exceeds array by %lx bytes\n",
  6360			    dlen - risc_size * sizeof(*dcode));
  6361			goto default_template;
  6362		}
  6363		ha->fw_dump_template_len = dlen;
  6364		return rval;
  6365	
  6366	default_template:
  6367		ql_log(ql_log_warn, vha, 0x0168, "Using default fwdump template\n");

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot May 21, 2017, 9:28 p.m. UTC | #2
Hi Joe,

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.12-rc1 next-20170519]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Bug-fixes-and-cleanups/20170521-131406
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   drivers/scsi/qla2xxx/qla_init.c: In function 'qla24xx_load_risc_flash':
>> drivers/scsi/qla2xxx/qla_init.c:6360:7: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'uint32_t' [-Wformat=]
          dlen - risc_size * sizeof(*dcode));
          ^
   drivers/scsi/qla2xxx/qla_init.c: In function 'qla24xx_load_risc_blob':
   drivers/scsi/qla2xxx/qla_init.c:6662:7: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'uint32_t' [-Wformat=]
          dlen - risc_size * sizeof(*fwcode));
          ^

vim +6360 drivers/scsi/qla2xxx/qla_init.c

  6344		qla24xx_read_flash_data(vha, dcode, faddr, risc_size);
  6345		for (i = 0; i < risc_size; i++)
  6346			dcode[i] = le32_to_cpu(dcode[i]);
  6347	
  6348		if (!qla27xx_fwdt_template_valid(dcode)) {
  6349			ql_log(ql_log_warn, vha, 0x0165,
  6350			    "Failed fwdump template validate\n");
  6351			goto default_template;
  6352		}
  6353	
  6354		dlen = qla27xx_fwdt_template_size(dcode);
  6355		ql_dbg(ql_dbg_init, vha, 0x0166,
  6356		    "-> template size %x bytes\n", dlen);
  6357		if (dlen > risc_size * sizeof(*dcode)) {
  6358			ql_log(ql_log_warn, vha, 0x0167,
  6359			    "Failed fwdump template exceeds array by %lx bytes\n",
> 6360			    dlen - risc_size * sizeof(*dcode));
  6361			goto default_template;
  6362		}
  6363		ha->fw_dump_template_len = dlen;
  6364		return rval;
  6365	
  6366	default_template:
  6367		ql_log(ql_log_warn, vha, 0x0168, "Using default fwdump template\n");
  6368		if (ha->fw_dump_template)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index f6130e8b1ca1..eaaf73fd23d9 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -6356,8 +6356,8 @@  qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
 	    "-> template size %x bytes\n", dlen);
 	if (dlen > risc_size * sizeof(*dcode)) {
 		ql_log(ql_log_warn, vha, 0x0167,
-		    "Failed fwdump template exceeds array by %x bytes\n",
-		    (uint32_t)(dlen - risc_size * sizeof(*dcode)));
+		    "Failed fwdump template exceeds array by %lx bytes\n",
+		    dlen - risc_size * sizeof(*dcode));
 		goto default_template;
 	}
 	ha->fw_dump_template_len = dlen;
@@ -6658,8 +6658,8 @@  qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
 	    "-> template size %x bytes\n", dlen);
 	if (dlen > risc_size * sizeof(*fwcode)) {
 		ql_log(ql_log_warn, vha, 0x0177,
-		    "Failed fwdump template exceeds array by %x bytes\n",
-		    (uint32_t)(dlen - risc_size * sizeof(*fwcode)));
+		    "Failed fwdump template exceeds array by %lx bytes\n",
+		    dlen - risc_size * sizeof(*fwcode));
 		goto default_template;
 	}
 	ha->fw_dump_template_len = dlen;
diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
index 8a58ef3adab4..2f2633a8c4ad 100644
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
@@ -219,8 +219,6 @@  qla27xx_skip_entry(struct qla27xx_fwdt_entry *ent, void *buf)
 {
 	if (buf)
 		ent->hdr.driver_flags |= DRIVER_FLAG_SKIP_ENTRY;
-	ql_dbg(ql_dbg_misc + ql_dbg_verbose, NULL, 0xd011,
-	    "Skipping entry %d\n", ent->hdr.entry_type);
 }
 
 static int
@@ -818,6 +816,8 @@  qla27xx_walk_template(struct scsi_qla_host *vha,
 	ql_dbg(ql_dbg_misc, vha, 0xd01a,
 	    "%s: entry count %lx\n", __func__, count);
 	while (count--) {
+		if (buf && *len >= vha->hw->fw_dump_len)
+			break;
 		if (qla27xx_find_entry(ent->hdr.entry_type)(vha, ent, buf, len))
 			break;
 		ent = qla27xx_next_entry(ent);
@@ -825,18 +825,20 @@  qla27xx_walk_template(struct scsi_qla_host *vha,
 
 	if (count)
 		ql_dbg(ql_dbg_misc, vha, 0xd018,
-		    "%s: residual count (%lx)\n", __func__, count);
+		    "%s: entry residual count (%lx)\n", __func__, count);
 
 	if (ent->hdr.entry_type != ENTRY_TYPE_TMP_END)
 		ql_dbg(ql_dbg_misc, vha, 0xd019,
-		    "%s: missing end (%lx)\n", __func__, count);
+		    "%s: missing end entry (%lx)\n", __func__, count);
 
-	ql_dbg(ql_dbg_misc, vha, 0xd01b,
-	    "%s: len=%lx\n", __func__, *len);
+	if (buf && *len != vha->hw->fw_dump_len)
+		ql_dbg(ql_dbg_misc, vha, 0xd01b,
+		    "%s: length=%#lx residual=%+ld\n",
+		    __func__, *len, vha->hw->fw_dump_len - *len);
 
 	if (buf) {
 		ql_log(ql_log_warn, vha, 0xd015,
-		    "Firmware dump saved to temp buffer (%ld/%p)\n",
+		    "Firmware dump saved to temp buffer (%lu/%p)\n",
 		    vha->host_no, vha->hw->fw_dump);
 		qla2x00_post_uevent_work(vha, QLA_UEVENT_CODE_FW_DUMP);
 	}