fs/squashfs/file_direct.c: replace count*size kmalloc by kcalloc
PATCH 1/1 fs/squashfs/file_direct.c: replace count*size kmalloc by kcalloc
kcalloc manages count*sizeof overflow.
Cc Phillip Lougher <[email protected]>
Cc Andrew Morton <[email protected]>
Signed-off-by Fabian Frederick <[email protected]>
--- fs/squashfs/file_direct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/squashfs/file_direct.c +1 -1
@@ -44,7 +44,7 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize) pages = end_index - start_index +1 ; - page =kmalloc (sizeof (void *) * pages,GFP_KERNEL ); + page =kcalloc (pages,sizeof (void *),GFP_KERNEL );if (page ==NULL )return res;
Signature · 1 line
1.8.4.5
Quoted 1 line · Fabian Frederick
kcalloc manages count*sizeof overflow.
so does kmalloc_array
fs/squashfs/file_direct.c
Quoted 1 line
fs/squashfs/file_direct.c +0
-0
[]
fs/squashfs/file_direct.c int squashfs_readpage_block(struct page *target_page, u64 block, int bsize) · line 47
Quoted 2 lines
fs/squashfs/file_direct.c +1
-1- page =kmalloc (sizeof (void *) * pages,GFP_KERNEL ); + page =kcalloc (pages,sizeof (void *),GFP_KERNEL );
kmalloc(a * sizeof(b), GFP) -> kmalloc_array(a, sizeof(b), GFP) kzalloc(a * sizeof(b), GFP) -> kcalloc(a, sizeof(b), GFP)