[lkml]   [2013]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH linux-next] cpqarray: do_ida_request() - reduce stack frame size
do_ida_request() can be called from within interrupt context.
A stack frame of more then 1K runs the risk of overflowing the
kernel stack. Correct this situation by dynamically allocating
the large (and temporary) scatter/gather array. A failure from kmalloc()
will leave a stack trace in the kernel log.

drivers/block/cpqarray.c: In function ‘do_ida_request’:
drivers/block/cpqarray.c:969:1: warning: the frame size of 1072 bytes is larger than 1024 bytes [-Wframe-larger-than=]

Cc: Chirag Kantharia <>
Signed-off-by: Tim Gardner <>
drivers/block/cpqarray.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 3f08713..2715b35 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -908,9 +908,13 @@ static void do_ida_request(struct request_queue *q)
ctlr_info_t *h = q->queuedata;
cmdlist_t *c;
struct request *creq;
- struct scatterlist tmp_sg[SG_MAX];
+ struct scatterlist *tmp_sg;
int i, dir, seg;

+ tmp_sg = kmalloc(sizeof(*tmp_sg) * SG_MAX, GFP_ATOMIC);
+ if (!tmp_sg)
+ return;
creq = blk_peek_request(q);
if (!creq)
@@ -966,6 +970,7 @@ DBGPX( printk("Submitting %u sectors in %d segments\n", blk_rq_sectors(creq), se

+ kfree(tmp_sg);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2013-02-18 22:23    [W:0.050 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site