|
Kmods SIG |
8b815c |
From 345482bc431f6492beb464696341626057f67771 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
8b815c |
From: Kari Argillander <kari.argillander@gmail.com>
|
|
Kmods SIG |
8b815c |
Date: Tue, 24 Aug 2021 21:37:08 +0300
|
|
Kmods SIG |
8b815c |
Subject: [Backport 345482bc431f] src: Use kcalloc/kmalloc_array over
|
|
Kmods SIG |
8b815c |
kzalloc/kmalloc
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
Use kcalloc/kmalloc_array over kzalloc/kmalloc when we allocate array.
|
|
Kmods SIG |
8b815c |
Checkpatch found these after we did not use our own defined allocation
|
|
Kmods SIG |
8b815c |
wrappers.
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
|
Kmods SIG |
8b815c |
Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
|
|
Kmods SIG |
8b815c |
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
|
|
Kmods SIG |
8b815c |
---
|
|
Kmods SIG |
8b815c |
src/bitmap.c | 2 +-
|
|
Kmods SIG |
8b815c |
src/file.c | 2 +-
|
|
Kmods SIG |
8b815c |
src/frecord.c | 7 +++----
|
|
Kmods SIG |
8b815c |
3 files changed, 5 insertions(+), 6 deletions(-)
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
diff --git a/src/bitmap.c b/src/bitmap.c
|
|
Kmods SIG |
8b815c |
index d502bba323d00e1ccafa7a0a0eeea46e0e36d796..2de05062c78b0aaa5799329aeb0065f0630f5f54 100644
|
|
Kmods SIG |
8b815c |
--- a/src/bitmap.c
|
|
Kmods SIG |
8b815c |
+++ b/src/bitmap.c
|
|
Kmods SIG |
8b815c |
@@ -683,7 +683,7 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits)
|
|
Kmods SIG |
8b815c |
if (!wnd->bits_last)
|
|
Kmods SIG |
8b815c |
wnd->bits_last = wbits;
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
- wnd->free_bits = kzalloc(wnd->nwnd * sizeof(u16), GFP_NOFS);
|
|
Kmods SIG |
8b815c |
+ wnd->free_bits = kcalloc(wnd->nwnd, sizeof(u16), GFP_NOFS);
|
|
Kmods SIG |
8b815c |
if (!wnd->free_bits)
|
|
Kmods SIG |
8b815c |
return -ENOMEM;
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
diff --git a/src/file.c b/src/file.c
|
|
Kmods SIG |
8b815c |
index 8d27c520bec56a1daca965fba7ba826049b18709..a959f6197c99e55275e12ffa78b9193f87bef942 100644
|
|
Kmods SIG |
8b815c |
--- a/src/file.c
|
|
Kmods SIG |
8b815c |
+++ b/src/file.c
|
|
Kmods SIG |
8b815c |
@@ -900,7 +900,7 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
|
|
Kmods SIG |
8b815c |
return -EOPNOTSUPP;
|
|
Kmods SIG |
8b815c |
}
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
- pages = kmalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS);
|
|
Kmods SIG |
8b815c |
+ pages = kmalloc_array(pages_per_frame, sizeof(struct page *), GFP_NOFS);
|
|
Kmods SIG |
8b815c |
if (!pages)
|
|
Kmods SIG |
8b815c |
return -ENOMEM;
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
diff --git a/src/frecord.c b/src/frecord.c
|
|
Kmods SIG |
8b815c |
index 2f7d165435307dc37dfbc6ba7959f04c1b218257..329bc76dfb09cb5d2a8e0215805d9a738c35bde6 100644
|
|
Kmods SIG |
8b815c |
--- a/src/frecord.c
|
|
Kmods SIG |
8b815c |
+++ b/src/frecord.c
|
|
Kmods SIG |
8b815c |
@@ -2054,7 +2054,7 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page)
|
|
Kmods SIG |
8b815c |
idx = (vbo - frame_vbo) >> PAGE_SHIFT;
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
pages_per_frame = frame_size >> PAGE_SHIFT;
|
|
Kmods SIG |
8b815c |
- pages = kzalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS);
|
|
Kmods SIG |
8b815c |
+ pages = kcalloc(pages_per_frame, sizeof(struct page *), GFP_NOFS);
|
|
Kmods SIG |
8b815c |
if (!pages) {
|
|
Kmods SIG |
8b815c |
err = -ENOMEM;
|
|
Kmods SIG |
8b815c |
goto out;
|
|
Kmods SIG |
8b815c |
@@ -2137,7 +2137,7 @@ int ni_decompress_file(struct ntfs_inode *ni)
|
|
Kmods SIG |
8b815c |
frame_bits = ni_ext_compress_bits(ni);
|
|
Kmods SIG |
8b815c |
frame_size = 1u << frame_bits;
|
|
Kmods SIG |
8b815c |
pages_per_frame = frame_size >> PAGE_SHIFT;
|
|
Kmods SIG |
8b815c |
- pages = kzalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS);
|
|
Kmods SIG |
8b815c |
+ pages = kcalloc(pages_per_frame, sizeof(struct page *), GFP_NOFS);
|
|
Kmods SIG |
8b815c |
if (!pages) {
|
|
Kmods SIG |
8b815c |
err = -ENOMEM;
|
|
Kmods SIG |
8b815c |
goto out;
|
|
Kmods SIG |
8b815c |
@@ -2709,8 +2709,7 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages,
|
|
Kmods SIG |
8b815c |
goto out;
|
|
Kmods SIG |
8b815c |
}
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
- pages_disk = kzalloc(pages_per_frame * sizeof(struct page *),
|
|
Kmods SIG |
8b815c |
- GFP_NOFS);
|
|
Kmods SIG |
8b815c |
+ pages_disk = kcalloc(pages_per_frame, sizeof(struct page *), GFP_NOFS);
|
|
Kmods SIG |
8b815c |
if (!pages_disk) {
|
|
Kmods SIG |
8b815c |
err = -ENOMEM;
|
|
Kmods SIG |
8b815c |
goto out;
|
|
Kmods SIG |
8b815c |
--
|
|
Kmods SIG |
8b815c |
2.31.1
|
|
Kmods SIG |
8b815c |
|