From: Andrew Morton <akpm@linux-foundation.org>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Valdis.Kletnieks@vt.edu, linux-kernel@vger.kernel.org
Subject: Re: rc4-mmotm1110 - Another build error
Date: Mon, 10 Nov 2008 23:13:14 -0800 [thread overview]
Message-ID: <20081110231314.27e639a4.akpm@linux-foundation.org> (raw)
In-Reply-To: <20081111155438.a46bdac1.kamezawa.hiroyu@jp.fujitsu.com>
On Tue, 11 Nov 2008 15:54:38 +0900 KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> On Mon, 10 Nov 2008 19:43:53 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Mon, 10 Nov 2008 22:20:33 -0500 Valdis.Kletnieks@vt.edu wrote:
> >
> > > gcc --version says:
> > > gcc (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7)
> > >
> > > ka-blam number 2:
> > >
> > > CC kernel/audit.o
> > > In file included from include/net/dst.h:15,
> > > from include/net/sock.h:57,
> > > from kernel/audit.c:54:
> > > include/net/neighbour.h:114: error: braced-group within expression allowed only inside a function
> > > make[1]: *** [kernel/audit.o] Error 1
> > >
> > > I'm placing bets on patches/align-avoid-evaluating-its-argument-twice.patch
> > >
> > > Yep, revert that patch, and audit.o compiles again.
> > >
> >
> > I hadn't got around to testing that one yet.
> >
> > So ug. ALIGN() is used in array sizing and hence has to be a
> > compile-time thing. But ALIGN(foo, bar()) will call bar() twice.
> >
> > Now how do we fix that?
>
> How about provoding
> - ALIGN() - args can be evaluated twice.
Well. The problem here is the risk of mistakes, and such an ALIGN()
could still be called by mistake.
> and
> - static inline unsigned long align()
ALIGN() is designed so that it can take any scalar types as arguments
and still do the right thing, so it can't really be implemented as an
inline.
> messy ?
I suppose we could switch all those ALIGN calls which must occur at
compile-time over to a new STATIC_ALIGN() (?) which is allowed to
evaluate its args twice, then fix ALIGN().
A bit of a pain, but any missed conversions would reliably fail to
compile and would get fixed quickly.
hm, ALIGN() is used in assembly too, but it means something totally
different, sigh.
<greps>
./arch/x86/mm/hugetlbpage.c: addr = ALIGN(start_addr, huge_page_size(h));
./arch/x86/mm/hugetlbpage.c: addr = ALIGN(vma->vm_end, huge_page_size(h));
./arch/x86/mm/hugetlbpage.c: addr = ALIGN(addr, huge_page_size(h));
These will presently be calling huge_page_size() twice.
Will these:
./drivers/mtd/ubi/build.c: ubi->ec_hdr_alsize = ALIGN(UBI_EC_HDR_SIZE, ubi->hdrs_min_io_size);
./drivers/mtd/ubi/build.c: ubi->vid_hdr_alsize = ALIGN(UBI_VID_HDR_SIZE, ubi->hdrs_min_io_size);
do the dereference twice? Probably not.
I didn't immediately spot any bugs, but I didn't look very closely.
Hopefully if there are any there, we'd have heard about it.
next prev parent reply other threads:[~2008-11-11 7:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-11 3:20 Valdis.Kletnieks
2008-11-11 3:43 ` Andrew Morton
2008-11-11 6:54 ` KAMEZAWA Hiroyuki
2008-11-11 7:13 ` Andrew Morton [this message]
2008-11-11 19:04 ` Valdis.Kletnieks
2008-11-11 19:18 ` Andrew Morton
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=20081110231314.27e639a4.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Valdis.Kletnieks@vt.edu \
--cc=kamezawa.hiroyu@jp.fujitsu.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
all inboxes | Powered by JetHome®