mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] optee: Fix a NULL vs IS_ERR() check
@ 2024-09-05 13:17 Dan Carpenter
  2024-09-05 14:08 ` Jens Wiklander
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2024-09-05 13:17 UTC (permalink / raw)
  To: Jens Wiklander
  Cc: Sumit Garg, Ulf Hansson, op-tee, linux-kernel, kernel-janitors

The tee_shm_get_va() function never returns NULL, it returns error
pointers.  Update the check to match.

Fixes: f0c8431568ee ("optee: probe RPMB device using RPMB subsystem")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/tee/optee/rpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
index a4b49fd1d46d..ebbbd42b0e3e 100644
--- a/drivers/tee/optee/rpc.c
+++ b/drivers/tee/optee/rpc.c
@@ -332,7 +332,7 @@ static void handle_rpc_func_rpmb_probe_next(struct tee_context *ctx,
 	}
 	buf = tee_shm_get_va(params[1].u.memref.shm,
 			     params[1].u.memref.shm_offs);
-	if (!buf) {
+	if (IS_ERR(buf)) {
 		arg->ret = TEEC_ERROR_BAD_PARAMETERS;
 		return;
 	}
-- 
2.45.2


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

* Re: [PATCH next] optee: Fix a NULL vs IS_ERR() check
  2024-09-05 13:17 [PATCH next] optee: Fix a NULL vs IS_ERR() check Dan Carpenter
@ 2024-09-05 14:08 ` Jens Wiklander
  2024-09-09 10:24   ` Ulf Hansson
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Wiklander @ 2024-09-05 14:08 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Sumit Garg, Ulf Hansson, op-tee, linux-kernel, kernel-janitors

On Thu, Sep 5, 2024 at 3:17 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> The tee_shm_get_va() function never returns NULL, it returns error
> pointers.  Update the check to match.
>
> Fixes: f0c8431568ee ("optee: probe RPMB device using RPMB subsystem")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/tee/optee/rpc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
> index a4b49fd1d46d..ebbbd42b0e3e 100644
> --- a/drivers/tee/optee/rpc.c
> +++ b/drivers/tee/optee/rpc.c
> @@ -332,7 +332,7 @@ static void handle_rpc_func_rpmb_probe_next(struct tee_context *ctx,
>         }
>         buf = tee_shm_get_va(params[1].u.memref.shm,
>                              params[1].u.memref.shm_offs);
> -       if (!buf) {
> +       if (IS_ERR(buf)) {
>                 arg->ret = TEEC_ERROR_BAD_PARAMETERS;
>                 return;
>         }
> --
> 2.45.2
>

Good catch.
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

Ulf, this is a fix for a patch in your next tree so if you could pick
up this patch, please.

Thanks,
Jens

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

* Re: [PATCH next] optee: Fix a NULL vs IS_ERR() check
  2024-09-05 14:08 ` Jens Wiklander
@ 2024-09-09 10:24   ` Ulf Hansson
  0 siblings, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2024-09-09 10:24 UTC (permalink / raw)
  To: Jens Wiklander, Dan Carpenter
  Cc: Sumit Garg, op-tee, linux-kernel, kernel-janitors

On Thu, 5 Sept 2024 at 16:09, Jens Wiklander <jens.wiklander@linaro.org> wrote:
>
> On Thu, Sep 5, 2024 at 3:17 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
> >
> > The tee_shm_get_va() function never returns NULL, it returns error
> > pointers.  Update the check to match.
> >
> > Fixes: f0c8431568ee ("optee: probe RPMB device using RPMB subsystem")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> >  drivers/tee/optee/rpc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
> > index a4b49fd1d46d..ebbbd42b0e3e 100644
> > --- a/drivers/tee/optee/rpc.c
> > +++ b/drivers/tee/optee/rpc.c
> > @@ -332,7 +332,7 @@ static void handle_rpc_func_rpmb_probe_next(struct tee_context *ctx,
> >         }
> >         buf = tee_shm_get_va(params[1].u.memref.shm,
> >                              params[1].u.memref.shm_offs);
> > -       if (!buf) {
> > +       if (IS_ERR(buf)) {
> >                 arg->ret = TEEC_ERROR_BAD_PARAMETERS;
> >                 return;
> >         }
> > --
> > 2.45.2
> >
>
> Good catch.
> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
>
> Ulf, this is a fix for a patch in your next tree so if you could pick
> up this patch, please.
>
> Thanks,
> Jens

Patch applied to the next branch to my mmc tree, thanks!

Kind regards
Uffe

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

end of thread, other threads:[~2024-09-09 10:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-05 13:17 [PATCH next] optee: Fix a NULL vs IS_ERR() check Dan Carpenter
2024-09-05 14:08 ` Jens Wiklander
2024-09-09 10:24   ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®