Re: [PATCH v2] [PATCH] KEYS: trusted: fix -Wvarags warning

2019-02-14 Thread Jarkko Sakkinen
On Wed, Feb 13, 2019 at 01:12:56AM +0200, Jarkko Sakkinen wrote: > On Mon, Feb 11, 2019 at 10:36:51AM -0800, Nick Desaulniers wrote: > > On Mon, Oct 29, 2018 at 10:54 AM Nick Desaulniers > > wrote: > > > > > > On Wed, Oct 24, 2018 at 1:37 AM Jarkko Sakkinen > > > wrote: > > > > > > > > On Mon,

Re: [PATCH v2] [PATCH] KEYS: trusted: fix -Wvarags warning

2019-02-12 Thread Jarkko Sakkinen
On Mon, Feb 11, 2019 at 10:36:51AM -0800, Nick Desaulniers wrote: > On Mon, Oct 29, 2018 at 10:54 AM Nick Desaulniers > wrote: > > > > On Wed, Oct 24, 2018 at 1:37 AM Jarkko Sakkinen > > wrote: > > > > > > On Mon, 22 Oct 2018, ndesaulni...@google.com wrote: > > > > Fixes the warning reported by

Re: [PATCH v2] [PATCH] KEYS: trusted: fix -Wvarags warning

2019-02-11 Thread Nick Desaulniers
On Mon, Oct 29, 2018 at 10:54 AM Nick Desaulniers wrote: > > On Wed, Oct 24, 2018 at 1:37 AM Jarkko Sakkinen > wrote: > > > > On Mon, 22 Oct 2018, ndesaulni...@google.com wrote: > > > Fixes the warning reported by Clang: > > > security/keys/trusted.c:146:17: warning: passing an object that > > >

Re: [PATCH v2] [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-29 Thread Nick Desaulniers
On Wed, Oct 24, 2018 at 1:37 AM Jarkko Sakkinen wrote: > > On Mon, 22 Oct 2018, ndesaulni...@google.com wrote: > > Fixes the warning reported by Clang: > > security/keys/trusted.c:146:17: warning: passing an object that > > undergoes default > > argument promotion to 'va_start' has undefined

Re: [PATCH v2] [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-29 Thread Nick Desaulniers
On Wed, Oct 24, 2018 at 1:37 AM Jarkko Sakkinen wrote: > > On Mon, 22 Oct 2018, ndesaulni...@google.com wrote: > > Fixes the warning reported by Clang: > > security/keys/trusted.c:146:17: warning: passing an object that > > undergoes default > > argument promotion to 'va_start' has undefined

Re: [PATCH v2] [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-24 Thread Jarkko Sakkinen
On Mon, 22 Oct 2018, ndesaulni...@google.com wrote: Fixes the warning reported by Clang: security/keys/trusted.c:146:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs] va_start(argp, h3); ^

Re: [PATCH v2] [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-24 Thread Jarkko Sakkinen
On Mon, 22 Oct 2018, ndesaulni...@google.com wrote: Fixes the warning reported by Clang: security/keys/trusted.c:146:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs] va_start(argp, h3); ^

Re: [PATCH v2] [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-22 Thread Nathan Chancellor
On Mon, Oct 22, 2018 at 04:43:57PM -0700, ndesaulni...@google.com wrote: > Fixes the warning reported by Clang: > security/keys/trusted.c:146:17: warning: passing an object that > undergoes default > argument promotion to 'va_start' has undefined behavior [-Wvarargs] > va_start(argp,

Re: [PATCH v2] [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-22 Thread Nathan Chancellor
On Mon, Oct 22, 2018 at 04:43:57PM -0700, ndesaulni...@google.com wrote: > Fixes the warning reported by Clang: > security/keys/trusted.c:146:17: warning: passing an object that > undergoes default > argument promotion to 'va_start' has undefined behavior [-Wvarargs] > va_start(argp,

[PATCH v2] [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-22 Thread ndesaulniers
Fixes the warning reported by Clang: security/keys/trusted.c:146:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs] va_start(argp, h3); ^ security/keys/trusted.c:126:37: note: parameter of

[PATCH v2] [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-22 Thread ndesaulniers
Fixes the warning reported by Clang: security/keys/trusted.c:146:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs] va_start(argp, h3); ^ security/keys/trusted.c:126:37: note: parameter of

RE: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-16 Thread David Laight
From: Nick Desaulniers > Sent: 15 October 2018 22:54 > On Mon, Oct 15, 2018 at 2:26 AM David Laight wrote: > > > > From: ndesaulni...@google.com > > > Sent: 11 October 2018 21:31 > > ... > > > by swapping h2 and h3. > > > > > > security/keys/trusted.c:146:17: warning: passing an object that > > >

RE: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-16 Thread David Laight
From: Nick Desaulniers > Sent: 15 October 2018 22:54 > On Mon, Oct 15, 2018 at 2:26 AM David Laight wrote: > > > > From: ndesaulni...@google.com > > > Sent: 11 October 2018 21:31 > > ... > > > by swapping h2 and h3. > > > > > > security/keys/trusted.c:146:17: warning: passing an object that > > >

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-15 Thread Nick Desaulniers
On Mon, Oct 15, 2018 at 2:26 AM David Laight wrote: > > From: ndesaulni...@google.com > > Sent: 11 October 2018 21:31 > ... > > by swapping h2 and h3. > > > > security/keys/trusted.c:146:17: warning: passing an object that > > undergoes default > > argument promotion to 'va_start' has

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-15 Thread Nick Desaulniers
On Mon, Oct 15, 2018 at 2:26 AM David Laight wrote: > > From: ndesaulni...@google.com > > Sent: 11 October 2018 21:31 > ... > > by swapping h2 and h3. > > > > security/keys/trusted.c:146:17: warning: passing an object that > > undergoes default > > argument promotion to 'va_start' has

RE: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-15 Thread David Laight
From: ndesaulni...@google.com > Sent: 11 October 2018 21:31 ... > by swapping h2 and h3. > > security/keys/trusted.c:146:17: warning: passing an object that > undergoes default > argument promotion to 'va_start' has undefined behavior [-Wvarargs] > va_start(argp, h3); >

RE: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-15 Thread David Laight
From: ndesaulni...@google.com > Sent: 11 October 2018 21:31 ... > by swapping h2 and h3. > > security/keys/trusted.c:146:17: warning: passing an object that > undergoes default > argument promotion to 'va_start' has undefined behavior [-Wvarargs] > va_start(argp, h3); >

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Fri, Oct 12, 2018 at 10:27 AM Denis Kenzior wrote: > > 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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Fri, Oct 12, 2018 at 10:27 AM Denis Kenzior wrote: > > 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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Fri, Oct 12, 2018 at 10:05 AM Nick Desaulniers wrote: > > On Fri, Oct 12, 2018 at 8:14 AM Denis Kenzior 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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Fri, Oct 12, 2018 at 10:05 AM Nick Desaulniers wrote: > > On Fri, Oct 12, 2018 at 8:14 AM Denis Kenzior 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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
Hi Nick, Refer to https://trustedcomputinggroup.org/wp-content/uploads/TPM-Main-Part-3-Commands_v1.2_rev116_01032011.pdf for details. Can you cite the relevant section? Just pick any section that describes a TPM command. I randomly used Section 10.3 for TPM Unbind. See the 'Incoming

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
Hi Nick, Refer to https://trustedcomputinggroup.org/wp-content/uploads/TPM-Main-Part-3-Commands_v1.2_rev116_01032011.pdf for details. Can you cite the relevant section? Just pick any section that describes a TPM command. I randomly used Section 10.3 for TPM Unbind. See the 'Incoming

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Fri, Oct 12, 2018 at 9:01 AM James Bottomley wrote: > > On Fri, 2018-10-12 at 10:53 -0500, Denis Kenzior wrote: > > Hi James, > > > > > > From the links provided in the patch it seems that one cannot > > > > pass char/float/short to va_start(). Fair enough. So if we make > > > > h3 an

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Fri, Oct 12, 2018 at 9:01 AM James Bottomley wrote: > > On Fri, 2018-10-12 at 10:53 -0500, Denis Kenzior wrote: > > Hi James, > > > > > > From the links provided in the patch it seems that one cannot > > > > pass char/float/short to va_start(). Fair enough. So if we make > > > > h3 an

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Fri, Oct 12, 2018 at 8:14 AM Denis Kenzior 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 *.

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Fri, Oct 12, 2018 at 8:14 AM Denis Kenzior 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 *.

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nathan Chancellor
On Fri, Oct 12, 2018 at 09:55:55AM -0700, Nick Desaulniers wrote: > On Thu, Oct 11, 2018 at 6:50 PM Nathan Chancellor > wrote: > > > > On Thu, Oct 11, 2018 at 01:31:26PM -0700, ndesaulni...@google.com wrote: > > > by swapping h2 and h3. > > > > > > security/keys/trusted.c:146:17: warning: passing

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nathan Chancellor
On Fri, Oct 12, 2018 at 09:55:55AM -0700, Nick Desaulniers wrote: > On Thu, Oct 11, 2018 at 6:50 PM Nathan Chancellor > wrote: > > > > On Thu, Oct 11, 2018 at 01:31:26PM -0700, ndesaulni...@google.com wrote: > > > by swapping h2 and h3. > > > > > > security/keys/trusted.c:146:17: warning: passing

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Fri, Oct 12, 2018 at 5:29 AM Denis Kenzior wrote: > > Hi Nick, > > > @@ -123,7 +123,7 @@ static int TSS_rawhmac(unsigned char *digest, const > > unsigned char *key, > >*/ > > static int TSS_authhmac(unsigned char *digest, const unsigned char *key, > > unsigned int

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Fri, Oct 12, 2018 at 5:29 AM Denis Kenzior wrote: > > Hi Nick, > > > @@ -123,7 +123,7 @@ static int TSS_rawhmac(unsigned char *digest, const > > unsigned char *key, > >*/ > > static int TSS_authhmac(unsigned char *digest, const unsigned char *key, > > unsigned int

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Thu, Oct 11, 2018 at 6:50 PM Nathan Chancellor wrote: > > On Thu, Oct 11, 2018 at 01:31:26PM -0700, ndesaulni...@google.com wrote: > > by swapping h2 and h3. > > > > security/keys/trusted.c:146:17: warning: passing an object that > > undergoes default > > argument promotion to 'va_start'

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Nick Desaulniers
On Thu, Oct 11, 2018 at 6:50 PM Nathan Chancellor wrote: > > On Thu, Oct 11, 2018 at 01:31:26PM -0700, ndesaulni...@google.com wrote: > > by swapping h2 and h3. > > > > security/keys/trusted.c:146:17: warning: passing an object that > > undergoes default > > argument promotion to 'va_start'

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread James Bottomley
On Fri, 2018-10-12 at 10:53 -0500, Denis Kenzior wrote: > Hi James, > > > > From the links provided in the patch it seems that one cannot > > > pass char/float/short to va_start(). Fair enough. So if we make > > > h3 an unsigned int, the issue goes away, no? > > > > For the current version

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread James Bottomley
On Fri, 2018-10-12 at 10:53 -0500, Denis Kenzior wrote: > Hi James, > > > > From the links provided in the patch it seems that one cannot > > > pass char/float/short to va_start(). Fair enough. So if we make > > > h3 an unsigned int, the issue goes away, no? > > > > For the current version

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
Hi James, From the links provided in the patch it seems that one cannot pass char/float/short to va_start(). Fair enough. So if we make h3 an unsigned int, the issue goes away, no? For the current version of clang, yes. However, if we're fixing this for good a char * pointer is the only

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
Hi James, From the links provided in the patch it seems that one cannot pass char/float/short to va_start(). Fair enough. So if we make h3 an unsigned int, the issue goes away, no? For the current version of clang, yes. However, if we're fixing this for good a char * pointer is the only

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread James Bottomley
On Fri, 2018-10-12 at 10:44 -0500, Denis Kenzior wrote: > Hi James, > > > > So instead of having unsigned char h3, can't we simply have bool > > > h3 or unsigned int h3? > > > > Given the ambiguity in the standards, the safe thing that will work > > for all time and all potential compilers is a

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread James Bottomley
On Fri, 2018-10-12 at 10:44 -0500, Denis Kenzior wrote: > Hi James, > > > > So instead of having unsigned char h3, can't we simply have bool > > > h3 or unsigned int h3? > > > > Given the ambiguity in the standards, the safe thing that will work > > for all time and all potential compilers is a

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
Hi James, So instead of having unsigned char h3, can't we simply have bool h3 or unsigned int h3? Given the ambiguity in the standards, the safe thing that will work for all time and all potential compilers is a char * All right. You state this with certainty, but I'd still like you to

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
Hi James, So instead of having unsigned char h3, can't we simply have bool h3 or unsigned int h3? Given the ambiguity in the standards, the safe thing that will work for all time and all potential compilers is a char * All right. You state this with certainty, but I'd still like you to

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread James Bottomley
On Fri, 2018-10-12 at 10:13 -0500, Denis Kenzior 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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread James Bottomley
On Fri, 2018-10-12 at 10:13 -0500, Denis Kenzior 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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread James Bottomley
On Fri, 2018-10-12 at 10:13 -0500, Denis Kenzior 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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread James Bottomley
On Fri, 2018-10-12 at 10:13 -0500, Denis Kenzior 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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
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

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread James Bottomley
On Fri, 2018-10-12 at 07:29 -0500, Denis Kenzior wrote: > Hi Nick, > > > @@ -123,7 +123,7 @@ static int TSS_rawhmac(unsigned char *digest, > > const unsigned char *key, > >*/ > > static int TSS_authhmac(unsigned char *digest, const unsigned > > char *key, > > unsigned

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread James Bottomley
On Fri, 2018-10-12 at 07:29 -0500, Denis Kenzior wrote: > Hi Nick, > > > @@ -123,7 +123,7 @@ static int TSS_rawhmac(unsigned char *digest, > > const unsigned char *key, > >*/ > > static int TSS_authhmac(unsigned char *digest, const unsigned > > char *key, > > unsigned

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
Hi Nick, @@ -123,7 +123,7 @@ static int TSS_rawhmac(unsigned char *digest, const unsigned char *key, */ static int TSS_authhmac(unsigned char *digest, const unsigned char *key, unsigned int keylen, unsigned char *h1, - unsigned char *h2,

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-12 Thread Denis Kenzior
Hi Nick, @@ -123,7 +123,7 @@ static int TSS_rawhmac(unsigned char *digest, const unsigned char *key, */ static int TSS_authhmac(unsigned char *digest, const unsigned char *key, unsigned int keylen, unsigned char *h1, - unsigned char *h2,

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-11 Thread Nathan Chancellor
On Thu, Oct 11, 2018 at 01:31:26PM -0700, ndesaulni...@google.com wrote: > by swapping h2 and h3. > > security/keys/trusted.c:146:17: warning: passing an object that > undergoes default > argument promotion to 'va_start' has undefined behavior [-Wvarargs] > va_start(argp, h3); >

Re: [PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-11 Thread Nathan Chancellor
On Thu, Oct 11, 2018 at 01:31:26PM -0700, ndesaulni...@google.com wrote: > by swapping h2 and h3. > > security/keys/trusted.c:146:17: warning: passing an object that > undergoes default > argument promotion to 'va_start' has undefined behavior [-Wvarargs] > va_start(argp, h3); >

[PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-11 Thread ndesaulniers
by swapping h2 and h3. security/keys/trusted.c:146:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs] va_start(argp, h3); ^ security/keys/trusted.c:126:37: note: parameter of type 'unsigned

[PATCH] KEYS: trusted: fix -Wvarags warning

2018-10-11 Thread ndesaulniers
by swapping h2 and h3. security/keys/trusted.c:146:17: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs] va_start(argp, h3); ^ security/keys/trusted.c:126:37: note: parameter of type 'unsigned