All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Tomas Winkler <tomas.winkler@intel.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	Alexander Usyskin <alexander.usyskin@intel.com>,
	linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] tpm: fix buffer type in tpm_transimt/_cmd
Date: Mon, 5 Mar 2018 20:12:49 +0200	[thread overview]
Message-ID: <20180305181249.GE6220@linux.intel.com> (raw)
In-Reply-To: <20180305124826.5160-2-tomas.winkler@intel.com>

On Mon, Mar 05, 2018 at 02:48:26PM +0200, Tomas Winkler wrote:
> 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: Tomas Winkler <tomas.winkler@intel.com>
> ---
>  drivers/char/tpm/tpm-interface.c | 8 ++++----
>  drivers/char/tpm/tpm.h           | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index cafec634181a..4afd95c83612 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -475,7 +475,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>  	if (rc)
>  		goto out;
>  
> -	rc = chip->ops->send(chip, (u8 *) buf, count);
> +	rc = chip->ops->send(chip, buf, count);
>  	if (rc < 0) {
>  		if (rc != -EPIPE)
>  			dev_err(&chip->dev,
> @@ -512,7 +512,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>  	goto out;
>  
>  out_recv:
> -	len = chip->ops->recv(chip, (u8 *) buf, bufsiz);
> +	len = chip->ops->recv(chip, buf, bufsiz);
>  	if (len < 0) {
>  		rc = len;
>  		dev_err(&chip->dev,
> @@ -567,7 +567,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>   *     A positive number for a TPM error.
>   */
>  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,
>  			 const char *desc)
>  {
> @@ -575,7 +575,7 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space,
>  	int err;
>  	ssize_t len;
>  
> -	len = tpm_transmit(chip, space, (u8 *)buf, bufsiz, flags);
> +	len = tpm_transmit(chip, space, buf, bufsiz, flags);
>  	if (len <  0)
>  		return len;
>  
> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> index b82b924d763c..50dcbf3b60aa 100644
> --- a/drivers/char/tpm/tpm.h
> +++ b/drivers/char/tpm/tpm.h
> @@ -520,7 +520,7 @@ enum tpm_transmit_flags {
>  ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>  		     u8 *buf, size_t bufsiz, unsigned int flags);
>  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,
>  			 const char *desc);
>  int tpm_startup(struct tpm_chip *chip);
> -- 
> 2.14.3
> 

Thanks, these changes have applied.

/Jarkko

WARNING: multiple messages have this Message-ID (diff)
From: jarkko.sakkinen@linux.intel.com (Jarkko Sakkinen)
To: linux-security-module@vger.kernel.org
Subject: [PATCH 2/2] tpm: fix buffer type in tpm_transimt/_cmd
Date: Mon, 5 Mar 2018 20:12:49 +0200	[thread overview]
Message-ID: <20180305181249.GE6220@linux.intel.com> (raw)
In-Reply-To: <20180305124826.5160-2-tomas.winkler@intel.com>

On Mon, Mar 05, 2018 at 02:48:26PM +0200, Tomas Winkler wrote:
> 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: Tomas Winkler <tomas.winkler@intel.com>
> ---
>  drivers/char/tpm/tpm-interface.c | 8 ++++----
>  drivers/char/tpm/tpm.h           | 2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index cafec634181a..4afd95c83612 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -475,7 +475,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>  	if (rc)
>  		goto out;
>  
> -	rc = chip->ops->send(chip, (u8 *) buf, count);
> +	rc = chip->ops->send(chip, buf, count);
>  	if (rc < 0) {
>  		if (rc != -EPIPE)
>  			dev_err(&chip->dev,
> @@ -512,7 +512,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>  	goto out;
>  
>  out_recv:
> -	len = chip->ops->recv(chip, (u8 *) buf, bufsiz);
> +	len = chip->ops->recv(chip, buf, bufsiz);
>  	if (len < 0) {
>  		rc = len;
>  		dev_err(&chip->dev,
> @@ -567,7 +567,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>   *     A positive number for a TPM error.
>   */
>  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,
>  			 const char *desc)
>  {
> @@ -575,7 +575,7 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_space *space,
>  	int err;
>  	ssize_t len;
>  
> -	len = tpm_transmit(chip, space, (u8 *)buf, bufsiz, flags);
> +	len = tpm_transmit(chip, space, buf, bufsiz, flags);
>  	if (len <  0)
>  		return len;
>  
> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> index b82b924d763c..50dcbf3b60aa 100644
> --- a/drivers/char/tpm/tpm.h
> +++ b/drivers/char/tpm/tpm.h
> @@ -520,7 +520,7 @@ enum tpm_transmit_flags {
>  ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>  		     u8 *buf, size_t bufsiz, unsigned int flags);
>  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,
>  			 const char *desc);
>  int tpm_startup(struct tpm_chip *chip);
> -- 
> 2.14.3
> 

Thanks, these changes have applied.

/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2018-03-05 18:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05 12:48 [PATCH 1/2] tpm: tpm-interface: fix tpm_transmit/_cmd kdoc Tomas Winkler
2018-03-05 12:48 ` Tomas Winkler
2018-03-05 12:48 ` [PATCH 2/2] tpm: fix buffer type in tpm_transimt/_cmd Tomas Winkler
2018-03-05 12:48   ` Tomas Winkler
2018-03-05 18:10   ` Jarkko Sakkinen
2018-03-05 18:10     ` Jarkko Sakkinen
2018-03-05 18:12   ` Jarkko Sakkinen [this message]
2018-03-05 18:12     ` Jarkko Sakkinen
2018-03-05 18:09 ` [PATCH 1/2] tpm: tpm-interface: fix tpm_transmit/_cmd kdoc Jarkko Sakkinen
2018-03-05 18:09   ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180305181249.GE6220@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=alexander.usyskin@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=tomas.winkler@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.