From: Catalin Marinas <catalin.marinas@arm.com>
To: Tejun Heo <htejun@gmail.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] Use a zero-size array in the struct devres
Date: Tue, 06 Mar 2007 09:54:37 +0000 [thread overview]
Message-ID: <20070306095241.28180.76390.stgit@localhost.localdomain> (raw)
Commit 9ac7849e35f705830f7b016ff272b0ff1f7ff759 adds the devres
structure containing a flexible unsigned long long array, with a
comment about the guaranteed alignment. According to the gcc manual,
flexible arrays are considered incomplete types and it is an error to
ask for their alignment. This patch makes data[] a zero-size array.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
I came across this when trying to build kmemleak as the modified
container_of macro tries to get the size of the devres.data member and
sizeof cannot be applied to incomplete types.
drivers/base/devres.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index e177c95..0d6c067 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -22,7 +22,7 @@ struct devres_node {
struct devres {
struct devres_node node;
/* -- 3 pointers */
- unsigned long long data[]; /* guarantee ull alignment */
+ unsigned long long data[0]; /* guarantee ull alignment */
};
struct devres_group {
next reply other threads:[~2007-03-06 10:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-06 9:54 Catalin Marinas [this message]
2007-03-06 12:44 ` [PATCH] Use a zero-size array in the struct devres Tejun Heo
2007-03-06 14:40 ` Catalin Marinas
2007-03-06 14:58 ` Tejun Heo
2007-03-06 15:21 ` Catalin Marinas
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=20070306095241.28180.76390.stgit@localhost.localdomain \
--to=catalin.marinas@arm.com \
--cc=htejun@gmail.com \
--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