linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fTPM: fix PTR_ERR() usage
@ 2019-07-12 11:49 Arnd Bergmann
  2019-07-12 15:34 ` Jarkko Sakkinen
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2019-07-12 11:49 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen
  Cc: Arnd Bergmann, Thirupathaiah Annapureddy, Sasha Levin,
	Jason Gunthorpe, Greg Kroah-Hartman, linux-integrity,
	linux-kernel

A last minute change must have confused PTR_ERR() and ERR_PTR():

drivers/char/tpm/tpm_ftpm_tee.c:236:15: error: incompatible pointer to integer conversion passing 'struct tee_context *' to parameter of type 'long' [-Werror,-Wint-conversion]
                if (ERR_PTR(pvt_data->ctx) == -ENOENT)
drivers/char/tpm/tpm_ftpm_tee.c:239:18: error: incompatible pointer to integer conversion passing 'struct tee_context *' to parameter of type 'long' [-Werror,-Wint-conversion]
                return ERR_PTR(pvt_data->ctx);

Fixes: c975c3911cc2 ("fTPM: firmware TPM running in TEE")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/char/tpm/tpm_ftpm_tee.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
index 74766a4d3280..5679a5af9a96 100644
--- a/drivers/char/tpm/tpm_ftpm_tee.c
+++ b/drivers/char/tpm/tpm_ftpm_tee.c
@@ -233,10 +233,10 @@ static int ftpm_tee_probe(struct platform_device *pdev)
 	pvt_data->ctx = tee_client_open_context(NULL, ftpm_tee_match, NULL,
 						NULL);
 	if (IS_ERR(pvt_data->ctx)) {
-		if (ERR_PTR(pvt_data->ctx) == -ENOENT)
+		if (PTR_ERR(pvt_data->ctx) == -ENOENT)
 			return -EPROBE_DEFER;
 		dev_err(dev, "%s: tee_client_open_context failed\n", __func__);
-		return ERR_PTR(pvt_data->ctx);
+		return PTR_ERR(pvt_data->ctx);
 	}
 
 	/* Open a session with fTPM TA */
-- 
2.20.0


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

* Re: [PATCH] fTPM: fix PTR_ERR() usage
  2019-07-12 11:49 [PATCH] fTPM: fix PTR_ERR() usage Arnd Bergmann
@ 2019-07-12 15:34 ` Jarkko Sakkinen
  2019-07-13 15:10   ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Jarkko Sakkinen @ 2019-07-12 15:34 UTC (permalink / raw)
  To: Arnd Bergmann, Peter Huewe
  Cc: Thirupathaiah Annapureddy, Sasha Levin, Jason Gunthorpe,
	Greg Kroah-Hartman, linux-integrity, linux-kernel

On Fri, 2019-07-12 at 13:49 +0200, Arnd Bergmann wrote:
> A last minute change must have confused PTR_ERR() and ERR_PTR():
> 
> drivers/char/tpm/tpm_ftpm_tee.c:236:15: error: incompatible pointer to integer
> conversion passing 'struct tee_context *' to parameter of type 'long' [-
> Werror,-Wint-conversion]
>                 if (ERR_PTR(pvt_data->ctx) == -ENOENT)
> drivers/char/tpm/tpm_ftpm_tee.c:239:18: error: incompatible pointer to integer
> conversion passing 'struct tee_context *' to parameter of type 'long' [-
> Werror,-Wint-conversion]
>                 return ERR_PTR(pvt_data->ctx);
> 
> Fixes: c975c3911cc2 ("fTPM: firmware TPM running in TEE")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Arnd, thanks.

I squashed this to the associated commit.

I also fine-tuned the commit messages a bit (tag, imperative form).

Started also wondering tha tpm_ftpm_tee is a too generic name given that
this is for ARM TZ only. Would it make sense to rename it as something
like tpm_ftpm_tee_arm? Other proposals are welcome. Just made something
up.


/Jarkko


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

* Re: [PATCH] fTPM: fix PTR_ERR() usage
  2019-07-12 15:34 ` Jarkko Sakkinen
@ 2019-07-13 15:10   ` Sasha Levin
  2019-07-14 14:38     ` Jarkko Sakkinen
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2019-07-13 15:10 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Arnd Bergmann, Peter Huewe, Thirupathaiah Annapureddy,
	Jason Gunthorpe, Greg Kroah-Hartman, linux-integrity,
	linux-kernel

On Fri, Jul 12, 2019 at 06:34:24PM +0300, Jarkko Sakkinen wrote:
>On Fri, 2019-07-12 at 13:49 +0200, Arnd Bergmann wrote:
>> A last minute change must have confused PTR_ERR() and ERR_PTR():
>>
>> drivers/char/tpm/tpm_ftpm_tee.c:236:15: error: incompatible pointer to integer
>> conversion passing 'struct tee_context *' to parameter of type 'long' [-
>> Werror,-Wint-conversion]
>>                 if (ERR_PTR(pvt_data->ctx) == -ENOENT)
>> drivers/char/tpm/tpm_ftpm_tee.c:239:18: error: incompatible pointer to integer
>> conversion passing 'struct tee_context *' to parameter of type 'long' [-
>> Werror,-Wint-conversion]
>>                 return ERR_PTR(pvt_data->ctx);
>>
>> Fixes: c975c3911cc2 ("fTPM: firmware TPM running in TEE")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
>Arnd, thanks.
>
>I squashed this to the associated commit.
>
>I also fine-tuned the commit messages a bit (tag, imperative form).

Yes, thank you!

>Started also wondering tha tpm_ftpm_tee is a too generic name given that
>this is for ARM TZ only. Would it make sense to rename it as something
>like tpm_ftpm_tee_arm? Other proposals are welcome. Just made something
>up.

Hm, isn't the _tee part enough?

--
Thanks,
Sasha

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

* Re: [PATCH] fTPM: fix PTR_ERR() usage
  2019-07-13 15:10   ` Sasha Levin
@ 2019-07-14 14:38     ` Jarkko Sakkinen
  0 siblings, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2019-07-14 14:38 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Arnd Bergmann, Peter Huewe, Thirupathaiah Annapureddy,
	Jason Gunthorpe, Greg Kroah-Hartman, linux-integrity,
	linux-kernel

On Sat, Jul 13, 2019 at 11:10:59AM -0400, Sasha Levin wrote:
> > Started also wondering tha tpm_ftpm_tee is a too generic name given that
> > this is for ARM TZ only. Would it make sense to rename it as something
> > like tpm_ftpm_tee_arm? Other proposals are welcome. Just made something
> > up.
> 
> Hm, isn't the _tee part enough?

Not sure, Trusted Execution Environment sounds something that could be
potentially used outside of ARM scope.

/Jarkko

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

end of thread, other threads:[~2019-07-14 14:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12 11:49 [PATCH] fTPM: fix PTR_ERR() usage Arnd Bergmann
2019-07-12 15:34 ` Jarkko Sakkinen
2019-07-13 15:10   ` Sasha Levin
2019-07-14 14:38     ` 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).