All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm/ppi: fix return type in tpm_show_ppi_response()
@ 2022-08-04  7:07 Dan Carpenter
  2022-08-06 18:11 ` Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-08-04  7:07 UTC (permalink / raw)
  To: Peter Huewe, Jiang Liu
  Cc: Jarkko Sakkinen, Jason Gunthorpe, Rafael J. Wysocki,
	linux-integrity, kernel-janitors

This "status" is declared as type acpi_status but it is never used to
store any acpi_statuses, only int.

The tpm_show_ppi_response() function returns ssize_t (signed long) and
acpi_status is unsigned int.  That means that negative error codes will
be type promoted to large positive values.

Fixes: 84b1667dea23 ("ACPI / TPM: replace open-coded _DSM code with helper functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/char/tpm/tpm_ppi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_ppi.c b/drivers/char/tpm/tpm_ppi.c
index 40018a73b3cb..240df925c38c 100644
--- a/drivers/char/tpm/tpm_ppi.c
+++ b/drivers/char/tpm/tpm_ppi.c
@@ -222,7 +222,7 @@ static ssize_t tpm_show_ppi_response(struct device *dev,
 				     struct device_attribute *attr,
 				     char *buf)
 {
-	acpi_status status = -EINVAL;
+	int status = -EINVAL;
 	union acpi_object *obj, *ret_obj;
 	u64 req, res;
 	struct tpm_chip *chip = to_tpm_chip(dev);
-- 
2.35.1


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

* Re: [PATCH] tpm/ppi: fix return type in tpm_show_ppi_response()
  2022-08-04  7:07 [PATCH] tpm/ppi: fix return type in tpm_show_ppi_response() Dan Carpenter
@ 2022-08-06 18:11 ` Jarkko Sakkinen
  0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2022-08-06 18:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Peter Huewe, Jiang Liu, Jason Gunthorpe, Rafael J. Wysocki,
	linux-integrity, kernel-janitors

On Thu, Aug 04, 2022 at 10:07:42AM +0300, Dan Carpenter wrote:
> This "status" is declared as type acpi_status but it is never used to
> store any acpi_statuses, only int.
> 
> The tpm_show_ppi_response() function returns ssize_t (signed long) and
> acpi_status is unsigned int.  That means that negative error codes will
> be type promoted to large positive values.
> 
> Fixes: 84b1667dea23 ("ACPI / TPM: replace open-coded _DSM code with helper functions")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/char/tpm/tpm_ppi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm_ppi.c b/drivers/char/tpm/tpm_ppi.c
> index 40018a73b3cb..240df925c38c 100644
> --- a/drivers/char/tpm/tpm_ppi.c
> +++ b/drivers/char/tpm/tpm_ppi.c
> @@ -222,7 +222,7 @@ static ssize_t tpm_show_ppi_response(struct device *dev,
>  				     struct device_attribute *attr,
>  				     char *buf)
>  {
> -	acpi_status status = -EINVAL;
> +	int status = -EINVAL;
>  	union acpi_object *obj, *ret_obj;
>  	u64 req, res;
>  	struct tpm_chip *chip = to_tpm_chip(dev);
> -- 
> 2.35.1
> 


Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

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

end of thread, other threads:[~2022-08-06 18:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-04  7:07 [PATCH] tpm/ppi: fix return type in tpm_show_ppi_response() Dan Carpenter
2022-08-06 18:11 ` Jarkko Sakkinen

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.