linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tpm: tpm-interface: fix tpm_transmit/_cmd  kdoc
@ 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 18:09 ` [PATCH 1/2] tpm: tpm-interface: fix tpm_transmit/_cmd kdoc Jarkko Sakkinen
  0 siblings, 2 replies; 5+ messages in thread
From: Tomas Winkler @ 2018-03-05 12:48 UTC (permalink / raw)
  To: Jarkko Sakkinen, Jason Gunthorpe
  Cc: Alexander Usyskin, linux-integrity, linux-security-module,
	linux-kernel, Tomas Winkler

Fix tmp_ -> tpm_ typo and add reference to 'space' parameter
in kdoc for tpm_transmit and tpm_transmit_cmd functions.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/char/tpm/tpm-interface.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 64dbec078c1b..cafec634181a 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -399,9 +399,10 @@ static void tpm_relinquish_locality(struct tpm_chip *chip)
 }
 
 /**
- * tmp_transmit - Internal kernel interface to transmit TPM commands.
+ * tpm_transmit - Internal kernel interface to transmit TPM commands.
  *
  * @chip: TPM chip to use
+ * @space: tpm space
  * @buf: TPM command buffer
  * @bufsiz: length of the TPM command buffer
  * @flags: tpm transmit flags - bitmap
@@ -549,10 +550,11 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
 }
 
 /**
- * tmp_transmit_cmd - send a tpm command to the device
+ * tpm_transmit_cmd - send a tpm command to the device
  *    The function extracts tpm out header return code
  *
  * @chip: TPM chip to use
+ * @space: tpm space
  * @buf: TPM command buffer
  * @bufsiz: length of the buffer
  * @min_rsp_body_length: minimum expected length of response body
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] tpm: fix buffer type in tpm_transimt/_cmd
  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 18:10   ` Jarkko Sakkinen
  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
  1 sibling, 2 replies; 5+ messages in thread
From: Tomas Winkler @ 2018-03-05 12:48 UTC (permalink / raw)
  To: Jarkko Sakkinen, Jason Gunthorpe
  Cc: Alexander Usyskin, linux-integrity, linux-security-module,
	linux-kernel, Tomas Winkler

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] tpm: tpm-interface: fix tpm_transmit/_cmd  kdoc
  2018-03-05 12:48 [PATCH 1/2] tpm: tpm-interface: fix tpm_transmit/_cmd kdoc Tomas Winkler
  2018-03-05 12:48 ` [PATCH 2/2] tpm: fix buffer type in tpm_transimt/_cmd Tomas Winkler
@ 2018-03-05 18:09 ` Jarkko Sakkinen
  1 sibling, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2018-03-05 18:09 UTC (permalink / raw)
  To: Tomas Winkler
  Cc: Jason Gunthorpe, Alexander Usyskin, linux-integrity,
	linux-security-module, linux-kernel

On Mon, Mar 05, 2018 at 02:48:25PM +0200, Tomas Winkler wrote:
> Fix tmp_ -> tpm_ typo and add reference to 'space' parameter
> in kdoc for tpm_transmit and tpm_transmit_cmd functions.
> 
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> ---
>  drivers/char/tpm/tpm-interface.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
> index 64dbec078c1b..cafec634181a 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -399,9 +399,10 @@ static void tpm_relinquish_locality(struct tpm_chip *chip)
>  }
>  
>  /**
> - * tmp_transmit - Internal kernel interface to transmit TPM commands.
> + * tpm_transmit - Internal kernel interface to transmit TPM commands.
>   *
>   * @chip: TPM chip to use
> + * @space: tpm space
>   * @buf: TPM command buffer
>   * @bufsiz: length of the TPM command buffer
>   * @flags: tpm transmit flags - bitmap
> @@ -549,10 +550,11 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
>  }
>  
>  /**
> - * tmp_transmit_cmd - send a tpm command to the device
> + * tpm_transmit_cmd - send a tpm command to the device
>   *    The function extracts tpm out header return code
>   *
>   * @chip: TPM chip to use
> + * @space: tpm space
>   * @buf: TPM command buffer
>   * @bufsiz: length of the buffer
>   * @min_rsp_body_length: minimum expected length of response body
> -- 
> 2.14.3
> 

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] tpm: fix buffer type in tpm_transimt/_cmd
  2018-03-05 12:48 ` [PATCH 2/2] tpm: fix buffer type in tpm_transimt/_cmd Tomas Winkler
@ 2018-03-05 18:10   ` Jarkko Sakkinen
  2018-03-05 18:12   ` Jarkko Sakkinen
  1 sibling, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2018-03-05 18:10 UTC (permalink / raw)
  To: Tomas Winkler
  Cc: Jason Gunthorpe, Alexander Usyskin, linux-integrity,
	linux-security-module, linux-kernel

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
> 

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] tpm: fix buffer type in tpm_transimt/_cmd
  2018-03-05 12:48 ` [PATCH 2/2] tpm: fix buffer type in tpm_transimt/_cmd Tomas Winkler
  2018-03-05 18:10   ` Jarkko Sakkinen
@ 2018-03-05 18:12   ` Jarkko Sakkinen
  1 sibling, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2018-03-05 18:12 UTC (permalink / raw)
  To: Tomas Winkler
  Cc: Jason Gunthorpe, Alexander Usyskin, linux-integrity,
	linux-security-module, linux-kernel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-05 18:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-05 12:48 [PATCH 1/2] tpm: tpm-interface: fix tpm_transmit/_cmd kdoc Tomas Winkler
2018-03-05 12:48 ` [PATCH 2/2] tpm: fix buffer type in tpm_transimt/_cmd Tomas Winkler
2018-03-05 18:10   ` Jarkko Sakkinen
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).