Commit 62c09e12 authored by Winkler, Tomas's avatar Winkler, Tomas Committed by Jarkko Sakkinen

tpm: fix buffer type in tpm_transmit_cmd

1. The buffer cannot be const as it is used both for send and receive.
2. Drop useless casting to u8 *, as this is already a
type of 'buf' parameter, it has just masked the 'const' issue.
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
parent 65520d46
...@@ -473,7 +473,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, ...@@ -473,7 +473,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
if (rc) if (rc)
goto out; goto out;
rc = chip->ops->send(chip, (u8 *) buf, count); rc = chip->ops->send(chip, buf, count);
if (rc < 0) { if (rc < 0) {
if (rc != -EPIPE) if (rc != -EPIPE)
dev_err(&chip->dev, dev_err(&chip->dev,
...@@ -510,7 +510,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, ...@@ -510,7 +510,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
goto out; goto out;
out_recv: out_recv:
len = chip->ops->recv(chip, (u8 *) buf, bufsiz); len = chip->ops->recv(chip, buf, bufsiz);
if (len < 0) { if (len < 0) {
rc = len; rc = len;
dev_err(&chip->dev, dev_err(&chip->dev,
...@@ -562,7 +562,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, ...@@ -562,7 +562,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
* A positive number for a TPM error. * A positive number for a TPM error.
*/ */
ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space, ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space,
const void *buf, size_t bufsiz, void *buf, size_t bufsiz,
size_t min_rsp_body_length, unsigned int flags, size_t min_rsp_body_length, unsigned int flags,
const char *desc) const char *desc)
{ {
...@@ -570,7 +570,7 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space, ...@@ -570,7 +570,7 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space,
int err; int err;
ssize_t len; ssize_t len;
len = tpm_transmit(chip, space, (u8 *)buf, bufsiz, flags); len = tpm_transmit(chip, space, buf, bufsiz, flags);
if (len < 0) if (len < 0)
return len; return len;
......
...@@ -506,7 +506,7 @@ enum tpm_transmit_flags { ...@@ -506,7 +506,7 @@ enum tpm_transmit_flags {
ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
u8 *buf, size_t bufsiz, unsigned int flags); u8 *buf, size_t bufsiz, unsigned int flags);
ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space, ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space,
const void *buf, size_t bufsiz, void *buf, size_t bufsiz,
size_t min_rsp_body_length, unsigned int flags, size_t min_rsp_body_length, unsigned int flags,
const char *desc); const char *desc);
int tpm_startup(struct tpm_chip *chip); int tpm_startup(struct tpm_chip *chip);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment