Skip to content

Commit cef3590

Browse files
lenko-daalexandrovich
authored andcommitted
fs/ntfs3: use kcalloc() instead of kzalloc()
We are trying to get rid of all multiplications from allocation functions to prevent integer overflows[1]. Here the multiplication is obviously safe, but using kcalloc() is more appropriate and improves readability. This patch has no effect on runtime behavior. Link: KSPP#162 [1] Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [2] Signed-off-by: Lenko Donchev <[email protected]> Signed-off-by: Konstantin Komarov <[email protected]>
1 parent 0bbac3f commit cef3590

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ntfs3/frecord.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2636,7 +2636,7 @@ int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages,
26362636
goto out1;
26372637
}
26382638

2639-
pages_disk = kzalloc(npages_disk * sizeof(struct page *), GFP_NOFS);
2639+
pages_disk = kcalloc(npages_disk, sizeof(*pages_disk), GFP_NOFS);
26402640
if (!pages_disk) {
26412641
err = -ENOMEM;
26422642
goto out2;

0 commit comments

Comments
 (0)