* [PATCH linux-next] tee/optee/shm_pool: fix application of sizeof to pointer
@ 2021-08-20 3:21 CGEL
2021-09-02 10:34 ` Daniel Thompson
0 siblings, 1 reply; 3+ messages in thread
From: CGEL @ 2021-08-20 3:21 UTC (permalink / raw)
To: Jens Wiklander
Cc: Sumit Garg, op-tee, linux-kernel, jing yangyang, Zeal Robot
From: jing yangyang <jing.yangyang@zte.com.cn>
sizeof when applied to a pointer typed expression gives the size of
the pointer.
./drivers/tee/optee/shm_pool.c:38:28-34: ERROR application of sizeof to pointer
This issue was detected with the help of Coccinelle.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
---
drivers/tee/optee/shm_pool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c
index c41a9a5..d167039 100644
--- a/drivers/tee/optee/shm_pool.c
+++ b/drivers/tee/optee/shm_pool.c
@@ -35,7 +35,7 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
unsigned int nr_pages = 1 << order, i;
struct page **pages;
- pages = kcalloc(nr_pages, sizeof(pages), GFP_KERNEL);
+ pages = kcalloc(nr_pages, sizeof(*pages), GFP_KERNEL);
if (!pages) {
rc = -ENOMEM;
goto err;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH linux-next] tee/optee/shm_pool: fix application of sizeof to pointer
2021-08-20 3:21 [PATCH linux-next] tee/optee/shm_pool: fix application of sizeof to pointer CGEL
@ 2021-09-02 10:34 ` Daniel Thompson
2021-09-13 9:21 ` Jens Wiklander
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Thompson @ 2021-09-02 10:34 UTC (permalink / raw)
To: CGEL
Cc: Jens Wiklander, Sumit Garg, op-tee, linux-kernel, jing yangyang,
Zeal Robot
On Thu, Aug 19, 2021 at 08:21:27PM -0700, CGEL wrote:
> From: jing yangyang <jing.yangyang@zte.com.cn>
>
> sizeof when applied to a pointer typed expression gives the size of
> the pointer.
>
> ./drivers/tee/optee/shm_pool.c:38:28-34: ERROR application of sizeof to pointer
>
> This issue was detected with the help of Coccinelle.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
This should not affect code generation since both pages and *pages are
pointers but the change looks good to me.
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
> ---
> drivers/tee/optee/shm_pool.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c
> index c41a9a5..d167039 100644
> --- a/drivers/tee/optee/shm_pool.c
> +++ b/drivers/tee/optee/shm_pool.c
> @@ -35,7 +35,7 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
> unsigned int nr_pages = 1 << order, i;
> struct page **pages;
>
> - pages = kcalloc(nr_pages, sizeof(pages), GFP_KERNEL);
> + pages = kcalloc(nr_pages, sizeof(*pages), GFP_KERNEL);
> if (!pages) {
> rc = -ENOMEM;
> goto err;
> --
> 1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH linux-next] tee/optee/shm_pool: fix application of sizeof to pointer
2021-09-02 10:34 ` Daniel Thompson
@ 2021-09-13 9:21 ` Jens Wiklander
0 siblings, 0 replies; 3+ messages in thread
From: Jens Wiklander @ 2021-09-13 9:21 UTC (permalink / raw)
To: Daniel Thompson
Cc: CGEL, Sumit Garg, op-tee, linux-kernel, jing yangyang, Zeal Robot
On Thu, Sep 02, 2021 at 11:34:28AM +0100, Daniel Thompson wrote:
> On Thu, Aug 19, 2021 at 08:21:27PM -0700, CGEL wrote:
> > From: jing yangyang <jing.yangyang@zte.com.cn>
> >
> > sizeof when applied to a pointer typed expression gives the size of
> > the pointer.
> >
> > ./drivers/tee/optee/shm_pool.c:38:28-34: ERROR application of sizeof to pointer
> >
> > This issue was detected with the help of Coccinelle.
> >
> > Reported-by: Zeal Robot <zealci@zte.com.cn>
> > Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
>
> This should not affect code generation since both pages and *pages are
> pointers but the change looks good to me.
>
> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Thanks for reviewing, I agree with your analysis.
I'm picking this up as a bugfix for V5.15.
Cheers,
Jens
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-13 9:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20 3:21 [PATCH linux-next] tee/optee/shm_pool: fix application of sizeof to pointer CGEL
2021-09-02 10:34 ` Daniel Thompson
2021-09-13 9:21 ` 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.