linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Smart <james.smart@emulex.com>
To: James.Bottomley@HansenPartnership.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH 7/8] lpfc 8.3.24: debugfs additions for SLI4
Date: Fri, 27 May 2011 23:49:52 -0400	[thread overview]
Message-ID: <1306554606.9543.4.camel@wookie> (raw)

>On Tue, 2011-05-24 at 11:44 -0400, James Smart wrote:
>> > debugfs additions for new SLI interface
>
>You guys need a newer compiler:
>
>drivers/scsi/lpfc/lpfc_debugfs.c: In function <91>lpfc_debugfs_dumpHBASlim_data.clone.3<92>:
>drivers/scsi/lpfc/lpfc_debugfs.c:412:1: warning: the frame size of 1036 bytes is larger than 1024 bytes
>drivers/scsi/lpfc/lpfc_debugfs.c: In function <91>lpfc_idiag_drbacc_write<92>:
>drivers/scsi/lpfc/lpfc_debugfs.c:2260:30: warning: <91>reg_val<92> may be used uninitialized in this function
>
>The reg_val problem looks to be just because the compiler can't work out
>that one of the if () statements will always be true.
>
>The stack overflow is the char buf[1024]
>
>James

yes, it appears so.  We didn't touch these areas, so a latent bug.  What rev are you running ?

I've updated the patch to add the diff below. I'll resend patch7 shortly.

-- james s


 ---

 lpfc_debugfs.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)


--- b/drivers/scsi/lpfc/lpfc_debugfs.c.ORIG	2011-05-27 23:08:48.000000000 -0400
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c	2011-05-27 23:15:10.000000000 -0400
@@ -379,16 +379,20 @@ lpfc_debugfs_dumpHBASlim_data(struct lpf
 	int len = 0;
 	int i, off;
 	uint32_t *ptr;
-	char buffer[1024];
+	char *dbuf;
+
+	dbuf = kmalloc(1024, GFP_KERNEL);
+	if (!dbuf)
+		goto out;
 
 	off = 0;
 	spin_lock_irq(&phba->hbalock);
 
 	len +=  snprintf(buf+len, size-len, "HBA SLIM\n");
-	lpfc_memcpy_from_slim(buffer,
+	lpfc_memcpy_from_slim(dbuf,
 		phba->MBslimaddr + lpfc_debugfs_last_hba_slim_off, 1024);
 
-	ptr = (uint32_t *)&buffer[0];
+	ptr = (uint32_t *)dbuf;
 	off = lpfc_debugfs_last_hba_slim_off;
 
 	/* Set it up for the next time */
@@ -408,6 +412,8 @@ lpfc_debugfs_dumpHBASlim_data(struct lpf
 	}
 
 	spin_unlock_irq(&phba->hbalock);
+	kfree(dbuf);
+out:
 	return len;
 }
 
@@ -2257,7 +2263,7 @@ lpfc_idiag_drbacc_write(struct file *fil
 {
 	struct lpfc_debug *debug = file->private_data;
 	struct lpfc_hba *phba = (struct lpfc_hba *)debug->i_private;
-	uint32_t drb_reg_id, value, reg_val;
+	uint32_t drb_reg_id, value, reg_val = 0;
 	void __iomem *drb_reg;
 	int rc;
 




             reply	other threads:[~2011-05-28  3:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28  3:49 James Smart [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-24 15:44 [PATCH 7/8] lpfc 8.3.24: debugfs additions for SLI4 James Smart
2011-05-26 23:18 ` James Bottomley

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=1306554606.9543.4.camel@wookie \
    --to=james.smart@emulex.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).