From: Peter Osterlund Date: Mon, 14 Nov 2005 00:06:36 +0000 (-0800) Subject: [PATCH] packet writing oops fix X-Git-Tag: v2.6.15-rc2~197 X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=ae7642bb05623988d8ca82b332dad1ed7bdb8ceb;p=powerpc.git [PATCH] packet writing oops fix There is an old bug in the pkt_count_states() function that causes stack corruption. When compiling with gcc 3.x or 2.x it is harmless, but gcc 4 allocates local variables differently, which makes the bug visible. Signed-off-by: Peter Osterlund Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 59e5982a5d..c0233efabe 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -1188,7 +1188,7 @@ static void pkt_count_states(struct pktcdvd_device *pd, int *states) struct packet_data *pkt; int i; - for (i = 0; i <= PACKET_NUM_STATES; i++) + for (i = 0; i < PACKET_NUM_STATES; i++) states[i] = 0; spin_lock(&pd->cdrw.active_list_lock);