diff options
author | Kari Argillander <kari.argillander@gmail.com> | 2021-08-24 21:37:07 +0300 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2021-08-27 17:05:12 +0300 |
commit | 195c52bdd5d5ecfdabf5a7c6159efe299e534f84 (patch) | |
tree | 19b4150df32241152b7b8233aa7099e1e7a794c5 /fs/ntfs3/attrlist.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/attrlist.c')
-rw-r--r-- | fs/ntfs3/attrlist.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ntfs3/attrlist.c b/fs/ntfs3/attrlist.c index ea561361b576..348bfb54db09 100644 --- a/fs/ntfs3/attrlist.c +++ b/fs/ntfs3/attrlist.c @@ -28,7 +28,7 @@ static inline bool al_is_valid_le(const struct ntfs_inode *ni, void al_destroy(struct ntfs_inode *ni) { run_close(&ni->attr_list.run); - ntfs_free(ni->attr_list.le); + kfree(ni->attr_list.le); ni->attr_list.le = NULL; ni->attr_list.size = 0; ni->attr_list.dirty = false; @@ -51,7 +51,7 @@ int ntfs_load_attr_list(struct ntfs_inode *ni, struct ATTRIB *attr) if (!attr->non_res) { lsize = le32_to_cpu(attr->res.data_size); - le = ntfs_malloc(al_aligned(lsize)); + le = kmalloc(al_aligned(lsize), GFP_NOFS); if (!le) { err = -ENOMEM; goto out; @@ -74,7 +74,7 @@ int ntfs_load_attr_list(struct ntfs_inode *ni, struct ATTRIB *attr) if (err < 0) goto out; - le = ntfs_malloc(al_aligned(lsize)); + le = kmalloc(al_aligned(lsize), GFP_NOFS); if (!le) { err = -ENOMEM; goto out; @@ -289,7 +289,7 @@ int al_add_le(struct ntfs_inode *ni, enum ATTR_TYPE type, const __le16 *name, off = PtrOffset(al->le, le); if (new_size > asize) { - void *ptr = ntfs_malloc(new_asize); + void *ptr = kmalloc(new_asize, GFP_NOFS); if (!ptr) return -ENOMEM; @@ -297,7 +297,7 @@ int al_add_le(struct ntfs_inode *ni, enum ATTR_TYPE type, const __le16 *name, memcpy(ptr, al->le, off); memcpy(Add2Ptr(ptr, off + sz), le, al->size - off); le = Add2Ptr(ptr, off); - ntfs_free(al->le); + kfree(al->le); al->le = ptr; } else { memmove(Add2Ptr(le, sz), le, al->size - off); |