public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] /drivers/scsi/lpfc/lpfc_debugfs.c (3.0.1) - the frame size of 1048 bytes is larger than 1024 bytes
       [not found] <1312749297.37983.YahooMailNeo@web45812.mail.sp1.yahoo.com>
@ 2011-08-08 19:54 ` James Smart
  0 siblings, 0 replies; only message in thread
From: James Smart @ 2011-08-08 19:54 UTC (permalink / raw)
  To: Poyo VL; +Cc: linux-scsi@vger.kernel.org

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-08 19:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1312749297.37983.YahooMailNeo@web45812.mail.sp1.yahoo.com>
2011-08-08 19:54 ` [PATCH] /drivers/scsi/lpfc/lpfc_debugfs.c (3.0.1) - the frame size of 1048 bytes is larger than 1024 bytes James Smart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox