* [PATCH] fix INIT_KFIFO in include/linux/kfifo.h - part 2
@ 2010-03-23 22:26 David Härdeman
2010-03-24 7:18 ` Stefani Seibold
0 siblings, 1 reply; 2+ messages in thread
From: David Härdeman @ 2010-03-23 22:26 UTC (permalink / raw)
To: linux-kernel; +Cc: stefani
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@hardeman.nu>
CC: stable@kernel.org
CC: stefani@seibold.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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] fix INIT_KFIFO in include/linux/kfifo.h - part 2
2010-03-23 22:26 [PATCH] fix INIT_KFIFO in include/linux/kfifo.h - part 2 David Härdeman
@ 2010-03-24 7:18 ` Stefani Seibold
0 siblings, 0 replies; 2+ messages in thread
From: Stefani Seibold @ 2010-03-24 7:18 UTC (permalink / raw)
To: David Härdeman; +Cc: linux-kernel
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@hardeman.nu>
Acked-by: stefani@seibold.net
CC: stable@kernel.org
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-24 7:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-23 22:26 [PATCH] fix INIT_KFIFO in include/linux/kfifo.h - part 2 David Härdeman
2010-03-24 7:18 ` Stefani Seibold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox