diff options
author | Kari Argillander | 2021-08-24 21:37:07 +0300 |
---|---|---|
committer | Konstantin Komarov | 2021-08-27 17:05:12 +0300 |
commit | 195c52bdd5d5ecfdabf5a7c6159efe299e534f84 (patch) | |
tree | 19b4150df32241152b7b8233aa7099e1e7a794c5 /fs/ntfs3/inode.c | |
parent | fa3cacf544636b2dc48cfb2f277a2071f14d66a2 (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/inode.c')
-rw-r--r-- | fs/ntfs3/inode.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 3a857e575ef2..520471f35e29 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1096,7 +1096,7 @@ ntfs_create_reparse_buffer(struct ntfs_sb_info *sbi, const char *symname, __le16 *rp_name; typeof(rp->SymbolicLinkReparseBuffer) *rs; - rp = ntfs_zalloc(ntfs_reparse_bytes(2 * size + 2)); + rp = kzalloc(ntfs_reparse_bytes(2 * size + 2), GFP_NOFS); if (!rp) return ERR_PTR(-ENOMEM); @@ -1151,7 +1151,7 @@ ntfs_create_reparse_buffer(struct ntfs_sb_info *sbi, const char *symname, return rp; out: - ntfs_free(rp); + kfree(rp); return ERR_PTR(err); } @@ -1619,7 +1619,7 @@ out3: out2: __putname(new_de); - ntfs_free(rp); + kfree(rp); out1: if (err) @@ -1862,7 +1862,7 @@ static noinline int ntfs_readlink_hlp(struct inode *inode, char *buffer, goto out; } } else { - rp = ntfs_malloc(i_size); + rp = kmalloc(i_size, GFP_NOFS); if (!rp) { err = -ENOMEM; goto out; @@ -1972,7 +1972,7 @@ static noinline int ntfs_readlink_hlp(struct inode *inode, char *buffer, /* Always set last zero */ buffer[err] = 0; out: - ntfs_free(to_free); + kfree(to_free); return err; } |