From: James Smart <james.smart@emulex.com>
To: Poyo VL <poyo_vl@yahoo.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] /drivers/scsi/lpfc/lpfc_debugfs.c (3.0.1) - the frame size of 1048 bytes is larger than 1024 bytes
Date: Mon, 8 Aug 2011 15:54:29 -0400 [thread overview]
Message-ID: <4E403EF5.2060604@emulex.com> (raw)
In-Reply-To: <1312749297.37983.YahooMailNeo@web45812.mail.sp1.yahoo.com>
Already corrected by the patch:
http://marc.info/?l=linux-scsi&m=131137432401391&w=2
Which is part of the lpfc 8.3.25 patchset.
-- james s
On 8/7/2011 4:34 PM, Poyo VL wrote:
> Hy,
>
> When I tried to compile the 3.0.1 kernel, I got the following warning:
>
> drivers/scsi/lpfc/lpfc_debugfs.c: In function ‘T.1107’:
> drivers/scsi/lpfc/lpfc_debugfs.c:411: warning: the frame size of 1048 bytes is
> larger than 1024 bytes
>
> But I think if the buffer is dinamically allocated, there is no problem.
>
> So, a simple patch would be:
>
> --- a/drivers/scsi/lpfc/lpfc_debugfs.c 2011-08-05 07:59:21.000000000 +0300
> +++ b/drivers/scsi/lpfc/lpfc_debugfs.c 2011-08-07 15:25:52.021158413 +0300
> @@ -378,7 +378,7 @@ lpfc_debugfs_dumpHBASlim_data(struct lpf
> int len = 0;
> int i, off;
> uint32_t *ptr;
> - char buffer[1024];
> + char *buffer = kmalloc(1024, GFP_KERNEL);
>
> off = 0;
> spin_lock_irq(&phba->hbalock);
> @@ -387,7 +387,7 @@ lpfc_debugfs_dumpHBASlim_data(struct lpf
> lpfc_memcpy_from_slim(buffer,
> phba->MBslimaddr + lpfc_debugfs_last_hba_slim_off, 1024);
>
> - ptr = (uint32_t *)&buffer[0];
> + ptr = (uint32_t *)buffer;
> off = lpfc_debugfs_last_hba_slim_off;
>
> /* Set it up for the next time */
> @@ -407,6 +407,7 @@ lpfc_debugfs_dumpHBASlim_data(struct lpf
> }
>
> spin_unlock_irq(&phba->hbalock);
> + kfree(buffer);
> return len;
> }
>
> Or, better, with an allocation check:
>
> --- a/drivers/scsi/lpfc/lpfc_debugfs.c 2011-08-05 07:59:21.000000000 +0300
> +++ b/drivers/scsi/lpfc/lpfc_debugfs.c 2011-08-07 15:45:48.007088993 +0300
> @@ -378,7 +378,12 @@ lpfc_debugfs_dumpHBASlim_data(struct lpf
> int len = 0;
> int i, off;
> uint32_t *ptr;
> - char buffer[1024];
> + char *buffer = kmalloc(1024, GFP_KERNEL);
> +
> + if(!buffer) {
> + printk(KERN_WARNING "lpfc_debugfs_dumpHBASlim_data: Unable to allocate
> memory\n");
> + return -ENOMEM;
> + }
>
> off = 0;
> spin_lock_irq(&phba->hbalock);
> @@ -387,7 +392,7 @@ lpfc_debugfs_dumpHBASlim_data(struct lpf
> lpfc_memcpy_from_slim(buffer,
> phba->MBslimaddr + lpfc_debugfs_last_hba_slim_off, 1024);
>
> - ptr = (uint32_t *)&buffer[0];
> + ptr = (uint32_t *)buffer;
> off = lpfc_debugfs_last_hba_slim_off;
>
> /* Set it up for the next time */
> @@ -407,6 +412,7 @@ lpfc_debugfs_dumpHBASlim_data(struct lpf
> }
>
> spin_unlock_irq(&phba->hbalock);
> + kfree(buffer);
> return len;
> }
>
> Signed-off-by: Ionut Gabriel Popescu <poyo_vl@yahoo.com>
>
> Also, buffer is a pointer, so it is not necessary a &buffer[0], it already
> points to the first element.
>
> Hope this is usefull...
>
> Have a nice day,
> Ionut Popescu
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
parent reply other threads:[~2011-08-08 19:54 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1312749297.37983.YahooMailNeo@web45812.mail.sp1.yahoo.com>]
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=4E403EF5.2060604@emulex.com \
--to=james.smart@emulex.com \
--cc=linux-scsi@vger.kernel.org \
--cc=poyo_vl@yahoo.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.