summaryrefslogtreecommitdiff
path: root/fs/ntfs3/fsntfs.c
diff options
context:
space:
mode:
authorKari Argillander <kari.argillander@gmail.com>2021-08-24 21:37:07 +0300
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2021-08-27 17:05:12 +0300
commit195c52bdd5d5ecfdabf5a7c6159efe299e534f84 (patch)
tree19b4150df32241152b7b8233aa7099e1e7a794c5 /fs/ntfs3/fsntfs.c
parentfa3cacf544636b2dc48cfb2f277a2071f14d66a2 (diff)
fs/ntfs3: Do not use driver own alloc wrappers
Problem with these wrapper is that we cannot take off example GFP_NOFS flag. It is not recomended use those in all places. Also if we change one driver specific wrapper to kernel wrapper then it would look really weird. People should be most familiar with kernel wrappers so let's just use those ones. Driver specific alloc wrapper also confuse some static analyzing tools, good example is example kernels checkpatch tool. After we converter these to kernel specific then warnings is showed. Following Coccinelle script was used to automate changing. virtual patch @alloc depends on patch@ expression x; expression y; @@ ( - ntfs_malloc(x) + kmalloc(x, GFP_NOFS) | - ntfs_zalloc(x) + kzalloc(x, GFP_NOFS) | - ntfs_vmalloc(x) + kvmalloc(x, GFP_NOFS) | - ntfs_free(x) + kfree(x) | - ntfs_vfree(x) + kvfree(x) | - ntfs_memdup(x, y) + kmemdup(x, y, GFP_NOFS) ) Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kari Argillander <kari.argillander@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/fsntfs.c')
-rw-r--r--fs/ntfs3/fsntfs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
index e887921a117d..fb2652c8dd74 100644
--- a/fs/ntfs3/fsntfs.c
+++ b/fs/ntfs3/fsntfs.c
@@ -2035,7 +2035,7 @@ int ntfs_get_security_by_id(struct ntfs_sb_info *sbi, __le32 security_id,
*size = t32 - SIZEOF_SECURITY_HDR;
- p = ntfs_malloc(*size);
+ p = kmalloc(*size, GFP_NOFS);
if (!p) {
err = -ENOMEM;
goto out;
@@ -2063,7 +2063,7 @@ int ntfs_get_security_by_id(struct ntfs_sb_info *sbi, __le32 security_id,
p = NULL;
out:
- ntfs_free(p);
+ kfree(p);
fnd_put(fnd_sii);
ni_unlock(ni);
@@ -2115,7 +2115,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi,
*security_id = SECURITY_ID_INVALID;
/* Allocate a temporal buffer*/
- d_security = ntfs_zalloc(aligned_sec_size);
+ d_security = kzalloc(aligned_sec_size, GFP_NOFS);
if (!d_security)
return -ENOMEM;
@@ -2279,7 +2279,7 @@ out:
fnd_put(fnd_sdh);
mark_inode_dirty(&ni->vfs_inode);
ni_unlock(ni);
- ntfs_free(d_security);
+ kfree(d_security);
return err;
}