[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1485889841.3199.57.camel@HansenPartnership.com>
Date: Tue, 31 Jan 2017 11:10:41 -0800
From: James Bottomley <James.Bottomley@...senPartnership.com>
To: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>,
tpmdd-devel@...ts.sourceforge.net
Cc: open list <linux-kernel@...r.kernel.org>,
linux-security-module@...r.kernel.org
Subject: Re: [tpmdd-devel] [PATCH] tpm: fix a sparse error in tpm-interface.c
On Tue, 2017-01-31 at 20:07 +0200, Jarkko Sakkinen wrote:
> drivers/char/tpm//tpm-interface.c:492:42: warning: bad assignment (
> -=)
> to restricted __be32
>
> Fixes: 0883743825e3 ("TPM: sysfs functions consolidation")
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
> ---
> drivers/char/tpm/tpm-interface.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm
> -interface.c
> index 423938e..746bc54 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -489,7 +489,7 @@ ssize_t tpm_getcap(struct tpm_chip *chip, u32
> subcap_id, cap_t *cap,
> tpm_cmd.params.getcap_in.cap =
> cpu_to_be32(subcap_id);
> /*subcap field not necessary */
> tpm_cmd.params.getcap_in.subcap_size =
> cpu_to_be32(0);
> - tpm_cmd.header.in.length -=
> cpu_to_be32(sizeof(__be32));
> + tpm_cmd.header.in.length = cpu_to_be32(18);
using bare numbers here without comment isn't really best practice.
What about setting header.in.length in both legs of the if() to either
tpm_cmd.header.in.length = cpu_to_be32(HEADER_SIZE + sizeof(struct tpm_getcap_params_in))
or
/* setting subcap_size to zero allows us to elimnate the subcap field */
tpm_cmd.header.in.length = cpu_to_be32(HEADER_SIZE + sizeof(struct tpm_getcap_params_in) - sizeof(tpm_cmd.params.getcap_in.subcap))
Powered by blists - more mailing lists