[PATCH 1/2] cpqfc: fix for "Using too much stach" in 2.6 kernel

Saripalli, Venkata Ramanamurthy (STSD)
2005-08-04T04:40:17Z

Patch 1 of 2

This patch fixes the "#error this is too much stack" in 2.6 kernel.
Using kmalloc to allocate memory to ulFibreFrame.

Please consider this for inclusion

Signed-off-by: Ramanamurthy Saripalli <saripalli@hp.com>

cpqfcTScontrol.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
------------------------------------------------------------------------
-------
diff -burpN old/drivers/scsi/cpqfcTScontrol.c
new/drivers/scsi/cpqfcTScontrol.c
--- old/drivers/scsi/cpqfcTScontrol.c 2005-07-12 22:52:29.000000000
+0530
+++ new/drivers/scsi/cpqfcTScontrol.c 2005-07-18 22:19:54.229947176
+0530
@@ -606,22 +606,25 @@ static int PeekIMQEntry( PTACHYON fcChip
if( (fcChip->IMQ->QEntry[CI].type & 0x1FF) == 0x104 )
{
TachFCHDR_GCMND* fchs;
-#error This is too much stack
- ULONG ulFibreFrame[2048/4]; // max DWORDS in incoming FC
Frame
+ ULONG *ulFibreFrame; // max DWORDS in incoming FC Frame
USHORT SFQpi = (USHORT)(fcChip->IMQ->QEntry[CI].word[0] &
0x0fffL);

+ ulFibreFrame = kmalloc((2048/4), GFP_KERNEL);
+
CpqTsGetSFQEntry( fcChip,
SFQpi, // SFQ producer ndx
ulFibreFrame, // contiguous dest. buffer
FALSE); // DON'T update chip--this is a "lookahead"

- fchs = (TachFCHDR_GCMND*)&ulFibreFrame;
+ fchs = (TachFCHDR_GCMND*)ulFibreFrame;
if( fchs->pl[0] == ELS_LILP_FRAME)
{
+ kfree(ulFibreFrame);
return 1; // found the LILP frame!
}
else
{
+ kfree(ulFibreFrame);
// keep looking...
}
}
@@ -718,12 +721,12 @@ int CpqTsProcessIMQEntry(void *host)
ULONG x_ID;
ULONG ulBuff, dwStatus;
TachFCHDR_GCMND* fchs;
-#error This is too much stack
- ULONG ulFibreFrame[2048/4]; // max number of DWORDS in incoming
Fibre Frame
+ ULONG *ulFibreFrame; // max number of DWORDS in incoming Fibre Frame
UCHAR ucInboundMessageType; // Inbound CM, dword 3 "type" field

ENTER("ProcessIMQEntry");

+ ulFibreFrame = kmalloc((2048/4), GFP_KERNEL);

// check TachLite's IMQ producer index -
// is a new message waiting for us?
@@ -1627,6 +1630,7 @@ int CpqTsProcessIMQEntry(void *host)

LEAVE("ProcessIMQEntry");

+ kfree(ulFibreFrame);
return iStatus;
}