From: David Härdeman Date: Tue, 6 Apr 2010 21:34:43 +0000 (-0700) Subject: include/linux/kfifo.h: fix INIT_KFIFO() X-Git-Tag: v2.6.34-rc4~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=530cd330dc3865e3107304a6e84fdc332aa72f7d;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git include/linux/kfifo.h: fix INIT_KFIFO() 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. Signed-off-by: David Härdeman Acked-by: Stefani Seibold Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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