From 195c52bdd5d5ecfdabf5a7c6159efe299e534f84 Mon Sep 17 00:00:00 2001 From: Kari Argillander Date: Tue, 24 Aug 2021 21:37:07 +0300 Subject: 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 Signed-off-by: Kari Argillander Signed-off-by: Konstantin Komarov --- fs/ntfs3/attrib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fs/ntfs3/attrib.c') diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index c15467ec12ed..4eae9886e27d 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -276,7 +276,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr, run_init(run); /* make a copy of original attribute */ - attr_s = ntfs_memdup(attr, asize); + attr_s = kmemdup(attr, asize, GFP_NOFS); if (!attr_s) { err = -ENOMEM; goto out; @@ -333,7 +333,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr, if (err) goto out3; - ntfs_free(attr_s); + kfree(attr_s); attr->nres.data_size = cpu_to_le64(rsize); attr->nres.valid_size = attr->nres.data_size; @@ -356,7 +356,7 @@ out2: run_deallocate(sbi, run, false); run_close(run); out1: - ntfs_free(attr_s); + kfree(attr_s); /*reinsert le*/ out: return err; -- cgit v1.2.3