Skip to content

Commit

Permalink
include/linux/kfifo.h: fix INIT_KFIFO()
Browse files Browse the repository at this point in the history
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 <david@hardeman.nu>
Acked-by: Stefani Seibold <stefani@seibold.net>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alphix authored and torvalds committed Apr 7, 2010
1 parent a3a2e76 commit 530cd33
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/linux/kfifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 530cd33

Please sign in to comment.