fix INIT_KFIFO in include/linux/kfifo.h - part 2
PATCH 1/1 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...
--- include/linux/kfifo.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/kfifo.h +2 -1
@@ -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
Signature · 1 line
1.7.0.3
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...
--- include/linux/kfifo.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
include/linux/kfifo.h +2 -1
@@ -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