[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100323222613.GA6915@hardeman.nu>
Date: Tue, 23 Mar 2010 23:26:13 +0100
From: David Härdeman <david@...deman.nu>
To: linux-kernel@...r.kernel.org
Cc: stefani@...bold.net
Subject: [PATCH] fix INIT_KFIFO in include/linux/kfifo.h - part 2
DECLARE_KFIFO creates a union with a struct kfifo and a buffer array with
size [size + sizeof(struct kfifo)].
INIT_KFIFO then sets the buffer pointer in struct kfifo to point to the
beginning of the buffer array which means that the first call to kfifo_in
will overwrite members of the struct kfifo.
This patch was the least invasive fix I could come up with...
Signed-off-by: David Härdeman <david@...deman.nu>
CC: stable@...nel.org
CC: stefani@...bold.net
---
include/linux/kfifo.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index ece0b1c..e117b1a 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -86,7 +86,8 @@ union { \
*/
#define INIT_KFIFO(name) \
name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \
- sizeof(struct kfifo), name##kfifo_buffer)
+ sizeof(struct kfifo), \
+ name##kfifo_buffer + sizeof(struct kfifo))
/**
* DEFINE_KFIFO - macro to define and initialize a kfifo
--
1.7.0.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists