* [PATCH] tee: remove unnecessary NULL check in tee_shm_alloc()
@ 2020-04-07 9:30 Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2020-04-07 9:30 UTC (permalink / raw)
To: kernel-janitors
Smatch complains that "ctx" isn't checked consistently:
drivers/tee/tee_shm.c:164 tee_shm_alloc()
warn: variable dereferenced before check 'ctx' (see line 95)
I audited the callers and "ctx" can't be NULL so the check can be
removed.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/tee/tee_shm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index bd679b72bd05..8895cb910166 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -161,8 +161,7 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags)
}
}
- if (ctx)
- teedev_ctx_get(ctx);
+ teedev_ctx_get(ctx);
return shm;
err_rem:
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] tee: remove unnecessary NULL check in tee_shm_alloc()
@ 2020-04-20 11:13 Jens Wiklander
0 siblings, 0 replies; 2+ messages in thread
From: Jens Wiklander @ 2020-04-20 11:13 UTC (permalink / raw)
To: kernel-janitors
On Tue, Apr 7, 2020 at 11:32 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Smatch complains that "ctx" isn't checked consistently:
>
> drivers/tee/tee_shm.c:164 tee_shm_alloc()
> warn: variable dereferenced before check 'ctx' (see line 95)
>
> I audited the callers and "ctx" can't be NULL so the check can be
> removed.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/tee/tee_shm.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Thanks, I'm picking this up.
Cheers,
Jens
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-20 11:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-07 9:30 [PATCH] tee: remove unnecessary NULL check in tee_shm_alloc() Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2020-04-20 11:13 Jens Wiklander
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.