[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdmStDm3Lz=W7XjmB7f7ihe4hLOmaBRLOrStbkBMRKwdjA@mail.gmail.com>
Date: Fri, 12 Oct 2018 10:05:48 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: denkenz@...il.com
Cc: jejb@...ux.ibm.com, dhowells@...hat.com,
Nathan Chancellor <natechancellor@...il.com>,
Eric Biggers <ebiggers@...gle.com>, zohar@...ux.vnet.ibm.com,
jmorris@...ei.org, serge@...lyn.com,
linux-integrity@...r.kernel.org, keyrings@...r.kernel.org,
linux-security-module@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] KEYS: trusted: fix -Wvarags warning
On Fri, Oct 12, 2018 at 8:14 AM Denis Kenzior <denkenz@...il.com> wrote:
>
> Hi James,
>
> >> So can't we simply use 'bool' or uint32 as the type for h3 instead
> >> of re-ordering everything
> >
> > The problem is the standard is ambiguious. The only thing that's
> > guaranteed to work for all time is a char *. If you want to keep the
> > order, what I'd suggest is inserting a dummy pointer argument which is
> > always expected to be NULL between the h3 and the varargs.
>
> So maybe I'm misunderstanding something, but the issue seems to be that
> unsigned char is promoted to 'unsigned char *' by Clang and probably
> unsigned int or int by gcc.
No. This is extremely well defined behavior in C. In C, integral
types are NEVER promoted to pointer to integer types, only to larger
integral types through rules more complicated than the correct flags
to pass to `tar`.
https://xkcd.com/1168/
>
> So instead of having unsigned char h3, can't we simply have bool h3 or
> unsigned int h3?
int is the default argument promotion. Proposed:
https://github.com/ClangBuiltLinux/linux/issues/41#issuecomment-428365339
>
> Regards,
> -Denis
>
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists