From: Arjan van de Ven <arjan@infradead.org>
To: Denis Vlasenko <vda@ilport.com.ua>
Cc: Adrian Bunk <bunk@stusta.de>,
Pekka J Enberg <penberg@cs.Helsinki.FI>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: [-mm patch] make kcalloc() a static inline
Date: Mon, 15 Aug 2005 10:14:20 +0200 [thread overview]
Message-ID: <1124093660.3228.14.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <200508151106.05973.vda@ilport.com.ua>
On Mon, 2005-08-15 at 11:06 +0300, Denis Vlasenko wrote:
> > +static inline void *kcalloc(size_t n, size_t size, unsigned int __nocast flags)
> > +{
> > + if (n != 0 && size > INT_MAX / n)
> > + return NULL;
> > + return kzalloc(n * size, flags);
> > +}
> Can you conditionalize it on __builtin_constant_p(n) ?
> Otherwise with variable n you have 3 oprations in inlined
> code, one of them a division.
you can't conditionalize the security check really. If it's constant,
gcc will optimize it anyway, and if it's not constant you for sure want
the check there...
next prev parent reply other threads:[~2005-08-15 8:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-08 22:38 Adrian Bunk
2005-08-09 5:09 ` Pekka J Enberg
2005-08-15 8:06 ` [-mm patch] " Denis Vlasenko
2005-08-15 8:14 ` Arjan van de Ven [this message]
2005-08-15 8:20 ` Denis Vlasenko
2005-08-15 8:28 ` Pekka J Enberg
2005-08-15 9:33 ` Denis Vlasenko
2005-08-15 9:41 ` Arjan van de Ven
2005-08-15 12:17 ` Denis Vlasenko
2005-08-15 12:25 ` Arjan van de Ven
2005-08-15 13:06 ` Pekka J Enberg
2005-08-15 13:51 ` Alan Cox
2005-08-15 16:30 ` Adrian Bunk
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=1124093660.3228.14.camel@laptopd505.fenrus.org \
--to=arjan@infradead.org \
--cc=akpm@osdl.org \
--cc=bunk@stusta.de \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.Helsinki.FI \
--cc=vda@ilport.com.ua \
/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®