tee: optee: fix type warning of sizeof in pool_op_alloc()
Subsystems (2)
PATCH 1/1 tee: optee: fix type warning of sizeof in pool_op_alloc()
sizeof() when applied to a pointer typed expression should gives the size of the pointed data, even if the data is a pointer.
Signed-off-by Liu Shixin <[email protected]>
--- drivers/tee/optee/shm_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tee/optee/shm_pool.c +1 -1
@@ -31,7 +31,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)return -ENOMEM ;
Signature · 1 line
2.25.1
Quoted 14 lines · Liu Shixin
sizeof()when applied to a pointer typed expression should gives the size of the pointed data, even if the data is a pointer.Signed-off-by Liu Shixin <[email protected]>--- drivers/tee/optee/shm_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/tee/optee/shm_pool.c +0
-0
drivers/tee/optee/shm_pool.c static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, · line 34
Quoted 5 lines
drivers/tee/optee/shm_pool.c +1
-1@@ -31,7 +31,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 );
In this case we want an array of pointers as you also can see in the type of "pages".
Thanks,
Jens
Quoted 6 lines
drivers/tee/optee/shm_pool.c +0
-1if (!pages)return -ENOMEM ; --2.25.1