Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1472257

Re: [PATCH] tpm: fix invalid constant expressions in tpm.h

From Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH] tpm: fix invalid constant expressions in tpm.h
Date 2016-08-30 08:40 +0200
Message-ID <sbKSd-1eU-13@gated-at.bofh.it> (permalink)
References <sbG2d-6uB-1@gated-at.bofh.it> <sbIdH-7Ro-1@gated-at.bofh.it>
Organization Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

Show all headers | View raw


On Mon, Aug 29, 2016 at 09:45:36PM -0600, Jason Gunthorpe wrote:
> On Tue, Aug 30, 2016 at 04:28:17AM +0300, Jarkko Sakkinen wrote:
> > The enums tpm_capabilities and tpm_sub_capabilities do not contain legit
> > constant expressions. This commit makes cap_id a separate parameter
> > in
> 
> I wonder if this is a bug in sparse? the macro uses gcc magic to
> expand to a constexpr.
> 
> You could also use __constant_cpu_to_be32 and similar instead.
> 
> But I admit I never liked the use of no-host endian in the constants..

It's too much magic for me, be it way or another :)


> >  #define TPM_ORD_STARTUP cpu_to_be32(153)
> >  #define TPM_ST_CLEAR cpu_to_be16(1)
> 
> Would be nice to see these fixed into an enum someday too

(putting note into my backlog text file)

> > +enum tpm1_capabilities {
> > +	TPM1_CAP_FLAG		= 0x04,
> > +	TPM1_CAP_PROP		= 0x05,
> > +	TPM1_CAP_VERSION_1_1	= 0x06,
> > +	TPM1_CAP_VERSION_1_2	= 0x1A,
> 
> I usually discourage the extra horizontal whitespace, just causes patch churn to
> keep it up (and clang-format won't do it automatically). Not sure if
> there is a consensus on that though.
> 
> But looks fine to me.
> 
> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Thanks!

> Jason

/Jarkko

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] tpm: fix invalid constant expressions in tpm.h Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-08-30 03:30 +0200
  Re: [PATCH] tpm: fix invalid constant expressions in tpm.h Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-08-30 05:50 +0200
    Re: [PATCH] tpm: fix invalid constant expressions in tpm.h Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-08-30 08:40 +0200

csiph-web