[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+55aFwG6gzgyDNSGXs+E3HmhPnAXpuZ1tAmFG4QgGeF5m9tAg@mail.gmail.com>
Date: Thu, 22 Mar 2018 10:04:14 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Kees Cook <keescook@...omium.org>
Cc: Al Viro <viro@...iv.linux.org.uk>,
Florian Weimer <fweimer@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Randy Dunlap <rdunlap@...radead.org>,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
Ingo Molnar <mingo@...nel.org>,
David Laight <David.Laight@...lab.com>,
Ian Abbott <abbotti@....co.uk>,
linux-input <linux-input@...r.kernel.org>,
linux-btrfs <linux-btrfs@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Kernel Hardening <kernel-hardening@...ts.openwall.com>
Subject: Re: [PATCH v5 0/2] Remove false-positive VLAs when using max()
On Thu, Mar 22, 2018 at 8:01 AM, Kees Cook <keescook@...omium.org> wrote:
>
> Seems like it doesn't like void * arguments:
Yeah, that was discussed separately, I just didn't realize we had any
such users.
As David said, just adding a (long) cast to it should be fine, ie
#define __is_constant(a) \
(sizeof(int) == sizeof(*(1 ? ((void*)((long)(a) * 0l)) : (int*)1)))
and is probably a good idea even outside of pointers (because "long
long" constants could cause warnings too due to the cast to (void *)).
Linus
Powered by blists - more mailing lists