Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1731784
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3] tpm: fix type of a local variables in tpm_tis_spi.c |
| Date | Wed, 13 Sep 2017 21:00:01 +0200 |
| Message-ID | <upl3b-2DF-9@gated-at.bofh.it> (permalink) |
| References | <upjE6-1RR-23@gated-at.bofh.it> |
| X-Original-To | tpmdd-devel@lists.sourceforge.net |
| X-Extloop1 | 1 |
| X-Ironport-Av | E=Sophos;i="5.42,389,1500966000"; d="scan'208";a="1218399210" |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| Organization | Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo |
| User-Agent | NeoMutt/20170609 (1.8.3) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 70 |
| X-Original-Cc | linux-security-module@vger.kernel.org, Peter Huewe <peterhuewe@gmx.de>, Marcel Selhorst <tpmdd@selhorst.net>, Jason Gunthorpe <jgunthorpe@obsidianresearch.com>, open list <linux-kernel@vger.kernel.org> |
| X-Original-Date | Wed, 13 Sep 2017 11:52:40 -0700 |
| X-Original-Message-ID | <20170913185240.wgzdlzeuc3fhf7fb@linux.intel.com> |
| X-Original-References | <20170913172654.25036-1-jarkko.sakkinen@linux.intel.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1731784 |
Show key headers only | View raw
Applied (as other similar) already to master because these are
very obvious things to fix. I'll wait for reviews and tests before
applying to next.
/Jarkko
On Wed, Sep 13, 2017 at 10:26:54AM -0700, Jarkko Sakkinen wrote:
> Use __le32 type for data in that format.
>
> Fixes: 0edbfea537d1 ("tpm/tpm_tis_spi: Add support for spi phy")
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> ---
> drivers/char/tpm/tpm_tis_spi.c | 25 ++++++++++++++++++-------
> 1 file changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c
> index 7e97eb07b200..bfe972959183 100644
> --- a/drivers/char/tpm/tpm_tis_spi.c
> +++ b/drivers/char/tpm/tpm_tis_spi.c
> @@ -153,29 +153,40 @@ static int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr,
>
> static int tpm_tis_spi_read16(struct tpm_tis_data *data, u32 addr, u16 *result)
> {
> + __le16 result_le;
> int rc;
>
> - rc = data->phy_ops->read_bytes(data, addr, sizeof(u16), (u8 *)result);
> + rc = data->phy_ops->read_bytes(data, addr, sizeof(u16),
> + (u8 *)&result_le);
> if (!rc)
> - *result = le16_to_cpu(*result);
> + *result = le16_to_cpu(result_le);
> +
> return rc;
> }
>
> static int tpm_tis_spi_read32(struct tpm_tis_data *data, u32 addr, u32 *result)
> {
> + __le32 result_le;
> int rc;
>
> - rc = data->phy_ops->read_bytes(data, addr, sizeof(u32), (u8 *)result);
> + rc = data->phy_ops->read_bytes(data, addr, sizeof(u32),
> + (u8 *)&result_le);
> if (!rc)
> - *result = le32_to_cpu(*result);
> + *result = le32_to_cpu(result_le);
> +
> return rc;
> }
>
> static int tpm_tis_spi_write32(struct tpm_tis_data *data, u32 addr, u32 value)
> {
> - value = cpu_to_le32(value);
> - return data->phy_ops->write_bytes(data, addr, sizeof(u32),
> - (u8 *)&value);
> + __le32 value_le;
> + int rc;
> +
> + value_le = cpu_to_le32(value);
> + rc = data->phy_ops->write_bytes(data, addr, sizeof(u32),
> + (u8 *)&value_le);
> +
> + return rc;
> }
>
> static const struct tpm_tis_phy_ops tpm_spi_phy_ops = {
> --
> 2.14.1
>
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 3/3] tpm: fix type of a local variables in tpm_tis_spi.c Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-09-13 19:30 +0200 Re: [PATCH 3/3] tpm: fix type of a local variables in tpm_tis_spi.c Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-09-13 21:00 +0200
csiph-web