Re: [PATCH] /drivers/scsi/lpfc/lpfc_debugfs.c (3.0.1) - the frame size of 1048 bytes is larger than 1024 bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux