public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefani Seibold <stefani@seibold.net>
To: "David Härdeman" <david@hardeman.nu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix INIT_KFIFO in include/linux/kfifo.h - part 2
Date: Wed, 24 Mar 2010 08:18:40 +0100	[thread overview]
Message-ID: <1269415120.19347.1.camel@wall-e.seibold.net> (raw)
In-Reply-To: <20100323222613.GA6915@hardeman.nu>

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



      reply	other threads:[~2010-03-24  7:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=1269415120.19347.1.camel@wall-e.seibold.net \
    --to=stefani@seibold.net \
    --cc=david@hardeman.nu \
    --cc=linux-kernel@vger.kernel.org \
    /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