diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2014-12-01 19:32:46 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-06 14:40:50 -0800 |
commit | 6280501c3e6346652bb9a1f2a77148f5aa5a37a6 (patch) | |
tree | 967c1af0946d47a80cc3aaf7a7ef20c0ef2be2bb | |
parent | 1c243c211c1141a14e5e418de314ed466c513ac6 (diff) | |
download | linux-stable-6280501c3e6346652bb9a1f2a77148f5aa5a37a6.tar.gz linux-stable-6280501c3e6346652bb9a1f2a77148f5aa5a37a6.tar.bz2 linux-stable-6280501c3e6346652bb9a1f2a77148f5aa5a37a6.zip |
tpm/tpm_i2c_stm_st33: Fix potential bug in tpm_stm_i2c_send
commit 1ba3b0b6f218072afe8372d12f1b6bf26a26008e upstream.
When sending data in tpm_stm_i2c_send, each loop iteration send buf.
Send buf + i instead as the goal of this for loop is to send a number
of byte from buf that fit in burstcnt. Once those byte are sent, we are
supposed to send the next ones.
The driver was working because the burstcount value returns always the maximum size for a TPM
command or response. (0x800 for a command and 0x400 for a response).
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/char/tpm/tpm_i2c_stm_st33.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c index 156bd3c72770..3925f7b86841 100644 --- a/drivers/char/tpm/tpm_i2c_stm_st33.c +++ b/drivers/char/tpm/tpm_i2c_stm_st33.c @@ -488,7 +488,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf, if (burstcnt < 0) return burstcnt; size = min_t(int, len - i - 1, burstcnt); - ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size); + ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf + i, size); if (ret < 0) goto out_err; |