From: "David Härdeman" <david@hardeman.nu>
To: linux-kernel@vger.kernel.org
Cc: stefani@seibold.net
Subject: [PATCH] fix INIT_KFIFO in include/linux/kfifo.h - part 2
Date: Tue, 23 Mar 2010 23:26:13 +0100 [thread overview]
Message-ID: <20100323222613.GA6915@hardeman.nu> (raw)
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
next reply other threads:[~2010-03-23 22:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-23 22:26 David Härdeman [this message]
2010-03-24 7:18 ` [PATCH] fix INIT_KFIFO in include/linux/kfifo.h - part 2 Stefani Seibold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100323222613.GA6915@hardeman.nu \
--to=david@hardeman.nu \
--cc=linux-kernel@vger.kernel.org \
--cc=stefani@seibold.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox