From: Denis Kenzior <denkenz@gmail.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: jejb@linux.ibm.com, dhowells@redhat.com,
Nathan Chancellor <natechancellor@gmail.com>,
Eric Biggers <ebiggers@google.com>,
zohar@linux.vnet.ibm.com, jmorris@namei.org, serge@hallyn.com,
linux-integrity@vger.kernel.org, keyrings@vger.kernel.org,
linux-security-module@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KEYS: trusted: fix -Wvarags warning
Date: Fri, 12 Oct 2018 12:27:00 -0500 [thread overview]
Message-ID: <80837c90-0425-aadd-38d7-c3c866d29a0a@gmail.com> (raw)
In-Reply-To: <CAKwvOdmStDm3Lz=W7XjmB7f7ihe4hLOmaBRLOrStbkBMRKwdjA@mail.gmail.com>
Hi Nick,
>> 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/
>
Ah right. Thanks for the correction. So looks like bool won't work for
the same reasons. But unsigned int should work right? But then again
this is a boolean value and if we want to be paranoid we can simply
tweak the 'c = h3' assignment to be something like:
c = !!h3;
So in the end, I'm happy with int or unsigned int.
Regards,
-Denis
next prev parent reply other threads:[~2018-10-12 17:27 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 22:11 undefined behavior (-Wvarargs) in security/keys/trusted.c#TSS_authhmac() Nick Desaulniers
2018-10-11 16:02 ` Arnd Bergmann
2018-10-11 16:10 ` James Bottomley
2018-10-11 20:31 ` [PATCH] KEYS: trusted: fix -Wvarags warning ndesaulniers
2018-10-12 1:50 ` Nathan Chancellor
2018-10-12 16:55 ` Nick Desaulniers
2018-10-12 17:03 ` Nathan Chancellor
2018-10-12 12:29 ` Denis Kenzior
2018-10-12 15:05 ` James Bottomley
2018-10-12 15:13 ` Denis Kenzior
2018-10-12 15:22 ` James Bottomley
2018-10-12 15:44 ` Denis Kenzior
2018-10-12 15:46 ` James Bottomley
2018-10-12 15:53 ` Denis Kenzior
2018-10-12 16:01 ` James Bottomley
2018-10-12 17:14 ` Nick Desaulniers
2018-10-12 15:25 ` James Bottomley
2018-10-12 17:05 ` Nick Desaulniers
2018-10-12 17:17 ` Nick Desaulniers
2018-10-12 17:27 ` Denis Kenzior [this message]
2018-10-12 18:39 ` Nick Desaulniers
2018-10-12 17:02 ` Nick Desaulniers
2018-10-12 17:15 ` Denis Kenzior
2018-10-15 9:26 ` David Laight
2018-10-15 21:53 ` Nick Desaulniers
2018-10-16 8:13 ` David Laight
2018-10-22 23:43 ` [PATCH v2] " ndesaulniers
2018-10-23 0:00 ` Nathan Chancellor
2018-10-24 8:36 ` Jarkko Sakkinen
2018-10-29 17:54 ` Nick Desaulniers
2019-02-11 18:36 ` Nick Desaulniers
2019-02-12 23:12 ` Jarkko Sakkinen
2019-02-14 10:52 ` Jarkko Sakkinen
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=80837c90-0425-aadd-38d7-c3c866d29a0a@gmail.com \
--to=denkenz@gmail.com \
--cc=dhowells@redhat.com \
--cc=ebiggers@google.com \
--cc=jejb@linux.ibm.com \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=serge@hallyn.com \
--cc=zohar@linux.vnet.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).