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/xattr.c | |
parent | fa3cacf544636b2dc48cfb2f277a2071f14d66a2 (diff) | |
download | linux-195c52bdd5d5ecfdabf5a7c6159efe299e534f84.tar.xz |
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/xattr.c')
-rw-r--r-- | fs/ntfs3/xattr.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 6b17d46b9506..af89e50f7b9f 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -110,7 +110,7 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea, return -EFBIG; /* Allocate memory for packed Ea */ - ea_p = ntfs_malloc(size + add_bytes); + ea_p = kmalloc(size + add_bytes, GFP_NOFS); if (!ea_p) return -ENOMEM; @@ -142,7 +142,7 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea, return 0; out: - ntfs_free(ea_p); + kfree(ea_p); *ea = NULL; return err; } @@ -193,7 +193,7 @@ static ssize_t ntfs_list_ea(struct ntfs_inode *ni, char *buffer, } out: - ntfs_free(ea_all); + kfree(ea_all); return err ? err : ret; } @@ -251,7 +251,7 @@ static int ntfs_get_ea(struct inode *inode, const char *name, size_t name_len, err = 0; out: - ntfs_free(ea_all); + kfree(ea_all); if (!required) ni_unlock(ni); @@ -352,7 +352,7 @@ static noinline int ntfs_set_ea(struct inode *inode, const char *name, } if (!ea_all) { - ea_all = ntfs_zalloc(add); + ea_all = kzalloc(add, GFP_NOFS); if (!ea_all) { err = -ENOMEM; goto out; @@ -474,7 +474,7 @@ out: ni_unlock(ni); run_close(&ea_run); - ntfs_free(ea_all); + kfree(ea_all); return err; } @@ -599,7 +599,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, value = NULL; } else { size = posix_acl_xattr_size(acl->a_count); - value = ntfs_malloc(size); + value = kmalloc(size, GFP_NOFS); if (!value) return -ENOMEM; @@ -614,7 +614,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, set_cached_acl(inode, type, acl); out: - ntfs_free(value); + kfree(value); return err; } @@ -880,7 +880,7 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de, err = sd_size; memcpy(buffer, sd, sd_size); } - ntfs_free(sd); + kfree(sd); goto out; } |