Commit 195c52bd authored by Kari Argillander's avatar Kari Argillander Committed by Konstantin Komarov

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKari Argillander <kari.argillander@gmail.com>
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent fa3cacf5
...@@ -276,7 +276,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr, ...@@ -276,7 +276,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,
run_init(run); run_init(run);
/* make a copy of original attribute */ /* make a copy of original attribute */
attr_s = ntfs_memdup(attr, asize); attr_s = kmemdup(attr, asize, GFP_NOFS);
if (!attr_s) { if (!attr_s) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -333,7 +333,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr, ...@@ -333,7 +333,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,
if (err) if (err)
goto out3; goto out3;
ntfs_free(attr_s); kfree(attr_s);
attr->nres.data_size = cpu_to_le64(rsize); attr->nres.data_size = cpu_to_le64(rsize);
attr->nres.valid_size = attr->nres.data_size; attr->nres.valid_size = attr->nres.data_size;
...@@ -356,7 +356,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr, ...@@ -356,7 +356,7 @@ int attr_make_nonresident(struct ntfs_inode *ni, struct ATTRIB *attr,
run_deallocate(sbi, run, false); run_deallocate(sbi, run, false);
run_close(run); run_close(run);
out1: out1:
ntfs_free(attr_s); kfree(attr_s);
/*reinsert le*/ /*reinsert le*/
out: out:
return err; return err;
......
...@@ -28,7 +28,7 @@ static inline bool al_is_valid_le(const struct ntfs_inode *ni, ...@@ -28,7 +28,7 @@ static inline bool al_is_valid_le(const struct ntfs_inode *ni,
void al_destroy(struct ntfs_inode *ni) void al_destroy(struct ntfs_inode *ni)
{ {
run_close(&ni->attr_list.run); 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.le = NULL;
ni->attr_list.size = 0; ni->attr_list.size = 0;
ni->attr_list.dirty = false; ni->attr_list.dirty = false;
...@@ -51,7 +51,7 @@ int ntfs_load_attr_list(struct ntfs_inode *ni, struct ATTRIB *attr) ...@@ -51,7 +51,7 @@ int ntfs_load_attr_list(struct ntfs_inode *ni, struct ATTRIB *attr)
if (!attr->non_res) { if (!attr->non_res) {
lsize = le32_to_cpu(attr->res.data_size); lsize = le32_to_cpu(attr->res.data_size);
le = ntfs_malloc(al_aligned(lsize)); le = kmalloc(al_aligned(lsize), GFP_NOFS);
if (!le) { if (!le) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -74,7 +74,7 @@ int ntfs_load_attr_list(struct ntfs_inode *ni, struct ATTRIB *attr) ...@@ -74,7 +74,7 @@ int ntfs_load_attr_list(struct ntfs_inode *ni, struct ATTRIB *attr)
if (err < 0) if (err < 0)
goto out; goto out;
le = ntfs_malloc(al_aligned(lsize)); le = kmalloc(al_aligned(lsize), GFP_NOFS);
if (!le) { if (!le) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -289,7 +289,7 @@ int al_add_le(struct ntfs_inode *ni, enum ATTR_TYPE type, const __le16 *name, ...@@ -289,7 +289,7 @@ int al_add_le(struct ntfs_inode *ni, enum ATTR_TYPE type, const __le16 *name,
off = PtrOffset(al->le, le); off = PtrOffset(al->le, le);
if (new_size > asize) { if (new_size > asize) {
void *ptr = ntfs_malloc(new_asize); void *ptr = kmalloc(new_asize, GFP_NOFS);
if (!ptr) if (!ptr)
return -ENOMEM; return -ENOMEM;
...@@ -297,7 +297,7 @@ int al_add_le(struct ntfs_inode *ni, enum ATTR_TYPE type, const __le16 *name, ...@@ -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(ptr, al->le, off);
memcpy(Add2Ptr(ptr, off + sz), le, al->size - off); memcpy(Add2Ptr(ptr, off + sz), le, al->size - off);
le = Add2Ptr(ptr, off); le = Add2Ptr(ptr, off);
ntfs_free(al->le); kfree(al->le);
al->le = ptr; al->le = ptr;
} else { } else {
memmove(Add2Ptr(le, sz), le, al->size - off); memmove(Add2Ptr(le, sz), le, al->size - off);
......
...@@ -133,7 +133,7 @@ void wnd_close(struct wnd_bitmap *wnd) ...@@ -133,7 +133,7 @@ void wnd_close(struct wnd_bitmap *wnd)
{ {
struct rb_node *node, *next; struct rb_node *node, *next;
ntfs_free(wnd->free_bits); kfree(wnd->free_bits);
run_close(&wnd->run); run_close(&wnd->run);
node = rb_first(&wnd->start_tree); node = rb_first(&wnd->start_tree);
...@@ -683,7 +683,7 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits) ...@@ -683,7 +683,7 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits)
if (!wnd->bits_last) if (!wnd->bits_last)
wnd->bits_last = wbits; wnd->bits_last = wbits;
wnd->free_bits = ntfs_zalloc(wnd->nwnd * sizeof(u16)); wnd->free_bits = kzalloc(wnd->nwnd * sizeof(u16), GFP_NOFS);
if (!wnd->free_bits) if (!wnd->free_bits)
return -ENOMEM; return -ENOMEM;
...@@ -1354,7 +1354,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits) ...@@ -1354,7 +1354,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits)
new_last = wbits; new_last = wbits;
if (new_wnd != wnd->nwnd) { if (new_wnd != wnd->nwnd) {
new_free = ntfs_malloc(new_wnd * sizeof(u16)); new_free = kmalloc(new_wnd * sizeof(u16), GFP_NOFS);
if (!new_free) if (!new_free)
return -ENOMEM; return -ENOMEM;
...@@ -1363,7 +1363,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits) ...@@ -1363,7 +1363,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits)
wnd->nwnd * sizeof(short)); wnd->nwnd * sizeof(short));
memset(new_free + wnd->nwnd, 0, memset(new_free + wnd->nwnd, 0,
(new_wnd - wnd->nwnd) * sizeof(short)); (new_wnd - wnd->nwnd) * sizeof(short));
ntfs_free(wnd->free_bits); kfree(wnd->free_bits);
wnd->free_bits = new_free; wnd->free_bits = new_free;
} }
......
...@@ -47,12 +47,5 @@ void ntfs_inode_printk(struct inode *inode, const char *fmt, ...) ...@@ -47,12 +47,5 @@ void ntfs_inode_printk(struct inode *inode, const char *fmt, ...)
#define ntfs_inode_warn(inode, fmt, ...) \ #define ntfs_inode_warn(inode, fmt, ...) \
ntfs_inode_printk(inode, KERN_WARNING fmt, ##__VA_ARGS__) ntfs_inode_printk(inode, KERN_WARNING fmt, ##__VA_ARGS__)
#define ntfs_malloc(s) kmalloc(s, GFP_NOFS)
#define ntfs_zalloc(s) kzalloc(s, GFP_NOFS)
#define ntfs_vmalloc(s) kvmalloc(s, GFP_KERNEL)
#define ntfs_free(p) kfree(p)
#define ntfs_vfree(p) kvfree(p)
#define ntfs_memdup(src, len) kmemdup(src, len, GFP_NOFS)
#endif /* _LINUX_NTFS3_DEBUG_H */ #endif /* _LINUX_NTFS3_DEBUG_H */
// clang-format on // clang-format on
...@@ -900,7 +900,7 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from) ...@@ -900,7 +900,7 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
pages = ntfs_malloc(pages_per_frame * sizeof(struct page *)); pages = kmalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS);
if (!pages) if (!pages)
return -ENOMEM; return -ENOMEM;
...@@ -1076,7 +1076,7 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from) ...@@ -1076,7 +1076,7 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from)
} }
out: out:
ntfs_free(pages); kfree(pages);
current->backing_dev_info = NULL; current->backing_dev_info = NULL;
......
...@@ -388,7 +388,7 @@ bool ni_add_subrecord(struct ntfs_inode *ni, CLST rno, struct mft_inode **mi) ...@@ -388,7 +388,7 @@ bool ni_add_subrecord(struct ntfs_inode *ni, CLST rno, struct mft_inode **mi)
{ {
struct mft_inode *m; struct mft_inode *m;
m = ntfs_zalloc(sizeof(struct mft_inode)); m = kzalloc(sizeof(struct mft_inode), GFP_NOFS);
if (!m) if (!m)
return false; return false;
...@@ -752,7 +752,7 @@ static int ni_try_remove_attr_list(struct ntfs_inode *ni) ...@@ -752,7 +752,7 @@ static int ni_try_remove_attr_list(struct ntfs_inode *ni)
run_deallocate(sbi, &ni->attr_list.run, true); run_deallocate(sbi, &ni->attr_list.run, true);
run_close(&ni->attr_list.run); run_close(&ni->attr_list.run);
ni->attr_list.size = 0; ni->attr_list.size = 0;
ntfs_free(ni->attr_list.le); kfree(ni->attr_list.le);
ni->attr_list.le = NULL; ni->attr_list.le = NULL;
ni->attr_list.dirty = false; ni->attr_list.dirty = false;
...@@ -787,7 +787,7 @@ int ni_create_attr_list(struct ntfs_inode *ni) ...@@ -787,7 +787,7 @@ int ni_create_attr_list(struct ntfs_inode *ni)
* Skip estimating exact memory requirement * Skip estimating exact memory requirement
* Looks like one record_size is always enough * Looks like one record_size is always enough
*/ */
le = ntfs_malloc(al_aligned(rs)); le = kmalloc(al_aligned(rs), GFP_NOFS);
if (!le) { if (!le) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -893,7 +893,7 @@ int ni_create_attr_list(struct ntfs_inode *ni) ...@@ -893,7 +893,7 @@ int ni_create_attr_list(struct ntfs_inode *ni)
goto out; goto out;
out1: out1:
ntfs_free(ni->attr_list.le); kfree(ni->attr_list.le);
ni->attr_list.le = NULL; ni->attr_list.le = NULL;
ni->attr_list.size = 0; ni->attr_list.size = 0;
...@@ -2054,7 +2054,7 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page) ...@@ -2054,7 +2054,7 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page)
idx = (vbo - frame_vbo) >> PAGE_SHIFT; idx = (vbo - frame_vbo) >> PAGE_SHIFT;
pages_per_frame = frame_size >> PAGE_SHIFT; pages_per_frame = frame_size >> PAGE_SHIFT;
pages = ntfs_zalloc(pages_per_frame * sizeof(struct page *)); pages = kzalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS);
if (!pages) { if (!pages) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -2092,7 +2092,7 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page) ...@@ -2092,7 +2092,7 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page)
out: out:
/* At this point, err contains 0 or -EIO depending on the "critical" page */ /* At this point, err contains 0 or -EIO depending on the "critical" page */
ntfs_free(pages); kfree(pages);
unlock_page(page); unlock_page(page);
return err; return err;
...@@ -2137,7 +2137,7 @@ int ni_decompress_file(struct ntfs_inode *ni) ...@@ -2137,7 +2137,7 @@ int ni_decompress_file(struct ntfs_inode *ni)
frame_bits = ni_ext_compress_bits(ni); frame_bits = ni_ext_compress_bits(ni);
frame_size = 1u << frame_bits; frame_size = 1u << frame_bits;
pages_per_frame = frame_size >> PAGE_SHIFT; pages_per_frame = frame_size >> PAGE_SHIFT;
pages = ntfs_zalloc(pages_per_frame * sizeof(struct page *)); pages = kzalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS);
if (!pages) { if (!pages) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -2298,7 +2298,7 @@ int ni_decompress_file(struct ntfs_inode *ni) ...@@ -2298,7 +2298,7 @@ int ni_decompress_file(struct ntfs_inode *ni)
mapping->a_ops = &ntfs_aops; mapping->a_ops = &ntfs_aops;
out: out:
ntfs_free(pages); kfree(pages);
if (err) { if (err) {
make_bad_inode(inode); make_bad_inode(inode);
ntfs_set_state(sbi, NTFS_DIRTY_ERROR); ntfs_set_state(sbi, NTFS_DIRTY_ERROR);
...@@ -2564,7 +2564,7 @@ int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages, ...@@ -2564,7 +2564,7 @@ int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages,
goto out1; goto out1;
} }
pages_disk = ntfs_zalloc(npages_disk * sizeof(struct page *)); pages_disk = kzalloc(npages_disk * sizeof(struct page *), GFP_NOFS);
if (!pages_disk) { if (!pages_disk) {
err = -ENOMEM; err = -ENOMEM;
goto out2; goto out2;
...@@ -2633,7 +2633,7 @@ int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages, ...@@ -2633,7 +2633,7 @@ int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages,
put_page(pg); put_page(pg);
} }
} }
ntfs_free(pages_disk); kfree(pages_disk);
out2: out2:
#ifdef CONFIG_NTFS3_LZX_XPRESS #ifdef CONFIG_NTFS3_LZX_XPRESS
...@@ -2709,7 +2709,8 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages, ...@@ -2709,7 +2709,8 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages,
goto out; goto out;
} }
pages_disk = ntfs_zalloc(pages_per_frame * sizeof(struct page *)); pages_disk = kzalloc(pages_per_frame * sizeof(struct page *),
GFP_NOFS);
if (!pages_disk) { if (!pages_disk) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -2769,7 +2770,7 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages, ...@@ -2769,7 +2770,7 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages,
compr_size = compress_lznt(frame_mem, frame_size, frame_ondisk, compr_size = compress_lznt(frame_mem, frame_size, frame_ondisk,
frame_size, sbi->compress.lznt); frame_size, sbi->compress.lznt);
mutex_unlock(&sbi->compress.mtx_lznt); mutex_unlock(&sbi->compress.mtx_lznt);
ntfs_free(lznt); kfree(lznt);
if (compr_size + sbi->cluster_size > frame_size) { if (compr_size + sbi->cluster_size > frame_size) {
/* frame is not compressed */ /* frame is not compressed */
...@@ -2818,7 +2819,7 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages, ...@@ -2818,7 +2819,7 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages,
put_page(pg); put_page(pg);
} }
} }
ntfs_free(pages_disk); kfree(pages_disk);
out: out:
return err; return err;
} }
......
This diff is collapsed.
...@@ -2035,7 +2035,7 @@ int ntfs_get_security_by_id(struct ntfs_sb_info *sbi, __le32 security_id, ...@@ -2035,7 +2035,7 @@ int ntfs_get_security_by_id(struct ntfs_sb_info *sbi, __le32 security_id,
*size = t32 - SIZEOF_SECURITY_HDR; *size = t32 - SIZEOF_SECURITY_HDR;
p = ntfs_malloc(*size); p = kmalloc(*size, GFP_NOFS);
if (!p) { if (!p) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -2063,7 +2063,7 @@ int ntfs_get_security_by_id(struct ntfs_sb_info *sbi, __le32 security_id, ...@@ -2063,7 +2063,7 @@ int ntfs_get_security_by_id(struct ntfs_sb_info *sbi, __le32 security_id,
p = NULL; p = NULL;
out: out:
ntfs_free(p); kfree(p);
fnd_put(fnd_sii); fnd_put(fnd_sii);
ni_unlock(ni); ni_unlock(ni);
...@@ -2115,7 +2115,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, ...@@ -2115,7 +2115,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi,
*security_id = SECURITY_ID_INVALID; *security_id = SECURITY_ID_INVALID;
/* Allocate a temporal buffer*/ /* Allocate a temporal buffer*/
d_security = ntfs_zalloc(aligned_sec_size); d_security = kzalloc(aligned_sec_size, GFP_NOFS);
if (!d_security) if (!d_security)
return -ENOMEM; return -ENOMEM;
...@@ -2279,7 +2279,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi, ...@@ -2279,7 +2279,7 @@ int ntfs_insert_security(struct ntfs_sb_info *sbi,
fnd_put(fnd_sdh); fnd_put(fnd_sdh);
mark_inode_dirty(&ni->vfs_inode); mark_inode_dirty(&ni->vfs_inode);
ni_unlock(ni); ni_unlock(ni);
ntfs_free(d_security); kfree(d_security);
return err; return err;
} }
......
...@@ -682,7 +682,7 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx, ...@@ -682,7 +682,7 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx,
if (end > 0x10000) if (end > 0x10000)
goto next; goto next;
offs = ntfs_malloc(sizeof(u16) * nslots); offs = kmalloc(sizeof(u16) * nslots, GFP_NOFS);
if (!offs) if (!offs)
goto next; goto next;
...@@ -704,10 +704,10 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx, ...@@ -704,10 +704,10 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx,
u16 *ptr; u16 *ptr;
int new_slots = ALIGN(2 * nslots, 8); int new_slots = ALIGN(2 * nslots, 8);
ptr = ntfs_malloc(sizeof(u16) * new_slots); ptr = kmalloc(sizeof(u16) * new_slots, GFP_NOFS);
if (ptr) if (ptr)
memcpy(ptr, offs, sizeof(u16) * max_idx); memcpy(ptr, offs, sizeof(u16) * max_idx);
ntfs_free(offs); kfree(offs);
offs = ptr; offs = ptr;
nslots = new_slots; nslots = new_slots;
if (!ptr) if (!ptr)
...@@ -764,7 +764,7 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx, ...@@ -764,7 +764,7 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx,
e = Add2Ptr(hdr, offs[fnd]); e = Add2Ptr(hdr, offs[fnd]);
out1: out1:
ntfs_free(offs); kfree(offs);
return e; return e;
#endif #endif
...@@ -934,21 +934,21 @@ static struct indx_node *indx_new(struct ntfs_index *indx, ...@@ -934,21 +934,21 @@ static struct indx_node *indx_new(struct ntfs_index *indx,
u16 fn; u16 fn;
u32 eo; u32 eo;
r = ntfs_zalloc(sizeof(struct indx_node)); r = kzalloc(sizeof(struct indx_node), GFP_NOFS);
if (!r) if (!r)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
index = ntfs_zalloc(bytes); index = kzalloc(bytes, GFP_NOFS);
if (!index) { if (!index) {
ntfs_free(r); kfree(r);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
err = ntfs_get_bh(ni->mi.sbi, &indx->alloc_run, vbo, bytes, &r->nb); err = ntfs_get_bh(ni->mi.sbi, &indx->alloc_run, vbo, bytes, &r->nb);
if (err) { if (err) {
ntfs_free(index); kfree(index);
ntfs_free(r); kfree(r);
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -1027,7 +1027,7 @@ int indx_read(struct ntfs_index *indx, struct ntfs_inode *ni, CLST vbn, ...@@ -1027,7 +1027,7 @@ int indx_read(struct ntfs_index *indx, struct ntfs_inode *ni, CLST vbn,
const struct INDEX_NAMES *name; const struct INDEX_NAMES *name;
if (!in) { if (!in) {
in = ntfs_zalloc(sizeof(struct indx_node)); in = kzalloc(sizeof(struct indx_node), GFP_NOFS);
if (!in) if (!in)
return -ENOMEM; return -ENOMEM;
} else { } else {
...@@ -1036,7 +1036,7 @@ int indx_read(struct ntfs_index *indx, struct ntfs_inode *ni, CLST vbn, ...@@ -1036,7 +1036,7 @@ int indx_read(struct ntfs_index *indx, struct ntfs_inode *ni, CLST vbn,
ib = in->index; ib = in->index;
if (!ib) { if (!ib) {
ib = ntfs_malloc(bytes); ib = kmalloc(bytes, GFP_NOFS);
if (!ib) { if (!ib) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -1083,11 +1083,11 @@ int indx_read(struct ntfs_index *indx, struct ntfs_inode *ni, CLST vbn, ...@@ -1083,11 +1083,11 @@ int indx_read(struct ntfs_index *indx, struct ntfs_inode *ni, CLST vbn,
out: out:
if (ib != in->index) if (ib != in->index)
ntfs_free(ib); kfree(ib);
if (*node != in) { if (*node != in) {
nb_put(&in->nb); nb_put(&in->nb);
ntfs_free(in); kfree(in);
} }
return err; return err;
...@@ -1219,7 +1219,7 @@ int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -1219,7 +1219,7 @@ int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni,
sizeof(struct NTFS_DE) + sizeof(u64)) { sizeof(struct NTFS_DE) + sizeof(u64)) {
if (n) { if (n) {
fnd_pop(fnd); fnd_pop(fnd);
ntfs_free(n); kfree(n);
} }
return -EINVAL; return -EINVAL;
} }
...@@ -1232,7 +1232,7 @@ int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -1232,7 +1232,7 @@ int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni,
/* Try next level */ /* Try next level */
e = hdr_first_de(&n->index->ihdr); e = hdr_first_de(&n->index->ihdr);
if (!e) { if (!e) {
ntfs_free(n); kfree(n);
return -EINVAL; return -EINVAL;
} }
...@@ -1252,7 +1252,7 @@ int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -1252,7 +1252,7 @@ int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni,
/* Pop one level */ /* Pop one level */
if (n) { if (n) {
fnd_pop(fnd); fnd_pop(fnd);
ntfs_free(n); kfree(n);
} }
level = fnd->level; level = fnd->level;
...@@ -1589,7 +1589,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -1589,7 +1589,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni,
} }
/* Make a copy of root attribute to restore if error */ /* Make a copy of root attribute to restore if error */
a_root = ntfs_memdup(attr, asize); a_root = kmemdup(attr, asize, GFP_NOFS);
if (!a_root) { if (!a_root) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -1615,7 +1615,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -1615,7 +1615,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni,
if (!to_move) { if (!to_move) {
re = NULL; re = NULL;
} else { } else {
re = ntfs_memdup(e0, to_move); re = kmemdup(e0, to_move, GFP_NOFS);
if (!re) { if (!re) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -1708,7 +1708,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -1708,7 +1708,7 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni,
* new entry classic case when mft record is 1K and index * new entry classic case when mft record is 1K and index
* buffer 4K the problem should not occurs * buffer 4K the problem should not occurs
*/ */
ntfs_free(re); kfree(re);
indx_write(indx, ni, n, 0); indx_write(indx, ni, n, 0);
put_indx_node(n); put_indx_node(n);
...@@ -1734,12 +1734,12 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -1734,12 +1734,12 @@ static int indx_insert_into_root(struct ntfs_index *indx, struct ntfs_inode *ni,
n = NULL; n = NULL;
out1: out1:
ntfs_free(re); kfree(re);
if (n) if (n)
put_indx_node(n); put_indx_node(n);
out: out:
ntfs_free(a_root); kfree(a_root);
return err; return err;
} }
...@@ -1792,7 +1792,7 @@ indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -1792,7 +1792,7 @@ indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni,
return -EINVAL; return -EINVAL;
sp_size = le16_to_cpu(sp->size); sp_size = le16_to_cpu(sp->size);
up_e = ntfs_malloc(sp_size + sizeof(u64)); up_e = kmalloc(sp_size + sizeof(u64), GFP_NOFS);
if (!up_e) if (!up_e)
return -ENOMEM; return -ENOMEM;
memcpy(up_e, sp, sp_size); memcpy(up_e, sp, sp_size);
...@@ -1870,7 +1870,7 @@ indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -1870,7 +1870,7 @@ indx_insert_into_buffer(struct ntfs_index *indx, struct ntfs_inode *ni,
} }
out: out:
ntfs_free(up_e); kfree(up_e);
return err; return err;
} }
...@@ -2149,7 +2149,7 @@ static int indx_get_entry_to_replace(struct ntfs_index *indx, ...@@ -2149,7 +2149,7 @@ static int indx_get_entry_to_replace(struct ntfs_index *indx,
n = fnd->nodes[level]; n = fnd->nodes[level];
te = hdr_first_de(&n->index->ihdr); te = hdr_first_de(&n->index->ihdr);
/* Copy the candidate entry into the replacement entry buffer. */ /* Copy the candidate entry into the replacement entry buffer. */
re = ntfs_malloc(le16_to_cpu(te->size) + sizeof(u64)); re = kmalloc(le16_to_cpu(te->size) + sizeof(u64), GFP_NOFS);
if (!re) { if (!re) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -2301,7 +2301,7 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -2301,7 +2301,7 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
fnd) fnd)
: indx_insert_into_root(indx, ni, re, e, : indx_insert_into_root(indx, ni, re, e,
ctx, fnd); ctx, fnd);
ntfs_free(re); kfree(re);
if (err) if (err)
goto out; goto out;
...@@ -2459,7 +2459,7 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -2459,7 +2459,7 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
* as appropriate. * as appropriate.
*/ */
e_size = le16_to_cpu(e->size); e_size = le16_to_cpu(e->size);
me = ntfs_memdup(e, e_size); me = kmemdup(e, e_size, GFP_NOFS);
if (!me) { if (!me) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -2505,7 +2505,7 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni, ...@@ -2505,7 +2505,7 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
* Find the spot the tree where we want to insert the new entry. * Find the spot the tree where we want to insert the new entry.
*/ */
err = indx_insert_entry(indx, ni, me, ctx, fnd); err = indx_insert_entry(indx, ni, me, ctx, fnd);
ntfs_free(me); kfree(me);
if (err) if (err)
goto out; goto out;
......
...@@ -1096,7 +1096,7 @@ ntfs_create_reparse_buffer(struct ntfs_sb_info *sbi, const char *symname, ...@@ -1096,7 +1096,7 @@ ntfs_create_reparse_buffer(struct ntfs_sb_info *sbi, const char *symname,
__le16 *rp_name; __le16 *rp_name;
typeof(rp->SymbolicLinkReparseBuffer) *rs; 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) if (!rp)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -1151,7 +1151,7 @@ ntfs_create_reparse_buffer(struct ntfs_sb_info *sbi, const char *symname, ...@@ -1151,7 +1151,7 @@ ntfs_create_reparse_buffer(struct ntfs_sb_info *sbi, const char *symname,
return rp; return rp;
out: out:
ntfs_free(rp); kfree(rp);
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -1619,7 +1619,7 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns, ...@@ -1619,7 +1619,7 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
out2: out2:
__putname(new_de); __putname(new_de);
ntfs_free(rp); kfree(rp);
out1: out1:
if (err) if (err)
...@@ -1862,7 +1862,7 @@ static noinline int ntfs_readlink_hlp(struct inode *inode, char *buffer, ...@@ -1862,7 +1862,7 @@ static noinline int ntfs_readlink_hlp(struct inode *inode, char *buffer,
goto out; goto out;
} }
} else { } else {
rp = ntfs_malloc(i_size); rp = kmalloc(i_size, GFP_NOFS);
if (!rp) { if (!rp) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -1972,7 +1972,7 @@ static noinline int ntfs_readlink_hlp(struct inode *inode, char *buffer, ...@@ -1972,7 +1972,7 @@ static noinline int ntfs_readlink_hlp(struct inode *inode, char *buffer,
/* Always set last zero */ /* Always set last zero */
buffer[err] = 0; buffer[err] = 0;
out: out:
ntfs_free(to_free); kfree(to_free);
return err; return err;
} }
......
...@@ -294,8 +294,8 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr, ...@@ -294,8 +294,8 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr,
*/ */
struct lznt *get_lznt_ctx(int level) struct lznt *get_lznt_ctx(int level)
{ {
struct lznt *r = ntfs_zalloc(level ? offsetof(struct lznt, hash) struct lznt *r = kzalloc(level ? offsetof(struct lznt, hash) :
: sizeof(struct lznt)); sizeof(struct lznt), GFP_NOFS);
if (r) if (r)
r->std = !level; r->std = !level;
......
...@@ -603,13 +603,13 @@ int indx_used_bit(struct ntfs_index *indx, struct ntfs_inode *ni, size_t *bit); ...@@ -603,13 +603,13 @@ int indx_used_bit(struct ntfs_index *indx, struct ntfs_inode *ni, size_t *bit);
void fnd_clear(struct ntfs_fnd *fnd); void fnd_clear(struct ntfs_fnd *fnd);
static inline struct ntfs_fnd *fnd_get(void) static inline struct ntfs_fnd *fnd_get(void)
{ {
return ntfs_zalloc(sizeof(struct ntfs_fnd)); return kzalloc(sizeof(struct ntfs_fnd), GFP_NOFS);
} }
static inline void fnd_put(struct ntfs_fnd *fnd) static inline void fnd_put(struct ntfs_fnd *fnd)
{ {
if (fnd) { if (fnd) {
fnd_clear(fnd); fnd_clear(fnd);
ntfs_free(fnd); kfree(fnd);
} }
} }
void indx_clear(struct ntfs_index *idx); void indx_clear(struct ntfs_index *idx);
...@@ -875,20 +875,20 @@ static inline void run_init(struct runs_tree *run) ...@@ -875,20 +875,20 @@ static inline void run_init(struct runs_tree *run)
static inline struct runs_tree *run_alloc(void) static inline struct runs_tree *run_alloc(void)
{ {
return ntfs_zalloc(sizeof(struct runs_tree)); return kzalloc(sizeof(struct runs_tree), GFP_NOFS);
} }
static inline void run_close(struct runs_tree *run) static inline void run_close(struct runs_tree *run)
{ {
ntfs_vfree(run->runs); kvfree(run->runs);
memset(run, 0, sizeof(*run)); memset(run, 0, sizeof(*run));
} }
static inline void run_free(struct runs_tree *run) static inline void run_free(struct runs_tree *run)
{ {
if (run) { if (run) {
ntfs_vfree(run->runs); kvfree(run->runs);
ntfs_free(run); kfree(run);
} }
} }
...@@ -1044,15 +1044,15 @@ static inline void put_indx_node(struct indx_node *in) ...@@ -1044,15 +1044,15 @@ static inline void put_indx_node(struct indx_node *in)
if (!in) if (!in)
return; return;
ntfs_free(in->index); kfree(in->index);
nb_put(&in->nb); nb_put(&in->nb);
ntfs_free(in); kfree(in);
} }
static inline void mi_clear(struct mft_inode *mi) static inline void mi_clear(struct mft_inode *mi)
{ {
nb_put(&mi->nb); nb_put(&mi->nb);
ntfs_free(mi->mrec); kfree(mi->mrec);
mi->mrec = NULL; mi->mrec = NULL;
} }
......
...@@ -76,14 +76,14 @@ static __le16 mi_new_attt_id(struct mft_inode *mi) ...@@ -76,14 +76,14 @@ static __le16 mi_new_attt_id(struct mft_inode *mi)
int mi_get(struct ntfs_sb_info *sbi, CLST rno, struct mft_inode **mi) int mi_get(struct ntfs_sb_info *sbi, CLST rno, struct mft_inode **mi)
{ {
int err; int err;
struct mft_inode *m = ntfs_zalloc(sizeof(struct mft_inode)); struct mft_inode *m = kzalloc(sizeof(struct mft_inode), GFP_NOFS);
if (!m) if (!m)
return -ENOMEM; return -ENOMEM;
err = mi_init(m, sbi, rno); err = mi_init(m, sbi, rno);
if (err) { if (err) {
ntfs_free(m); kfree(m);
return err; return err;
} }
...@@ -100,14 +100,14 @@ int mi_get(struct ntfs_sb_info *sbi, CLST rno, struct mft_inode **mi) ...@@ -100,14 +100,14 @@ int mi_get(struct ntfs_sb_info *sbi, CLST rno, struct mft_inode **mi)
void mi_put(struct mft_inode *mi) void mi_put(struct mft_inode *mi)
{ {
mi_clear(mi); mi_clear(mi);
ntfs_free(mi); kfree(mi);
} }
int mi_init(struct mft_inode *mi, struct ntfs_sb_info *sbi, CLST rno) int mi_init(struct mft_inode *mi, struct ntfs_sb_info *sbi, CLST rno)
{ {
mi->sbi = sbi; mi->sbi = sbi;
mi->rno = rno; mi->rno = rno;
mi->mrec = ntfs_malloc(sbi->record_size); mi->mrec = kmalloc(sbi->record_size, GFP_NOFS);
if (!mi->mrec) if (!mi->mrec)
return -ENOMEM; return -ENOMEM;
......
...@@ -254,7 +254,7 @@ void run_truncate_head(struct runs_tree *run, CLST vcn) ...@@ -254,7 +254,7 @@ void run_truncate_head(struct runs_tree *run, CLST vcn)
run->count -= index; run->count -= index;
if (!run->count) { if (!run->count) {
ntfs_vfree(run->runs); kvfree(run->runs);
run->runs = NULL; run->runs = NULL;
run->allocated = 0; run->allocated = 0;
} }
...@@ -293,7 +293,7 @@ void run_truncate(struct runs_tree *run, CLST vcn) ...@@ -293,7 +293,7 @@ void run_truncate(struct runs_tree *run, CLST vcn)
/* Do not reallocate array 'runs'. Only free if possible */ /* Do not reallocate array 'runs'. Only free if possible */
if (!index) { if (!index) {
ntfs_vfree(run->runs); kvfree(run->runs);
run->runs = NULL; run->runs = NULL;
run->allocated = 0; run->allocated = 0;
} }
...@@ -388,7 +388,7 @@ bool run_add_entry(struct runs_tree *run, CLST vcn, CLST lcn, CLST len, ...@@ -388,7 +388,7 @@ bool run_add_entry(struct runs_tree *run, CLST vcn, CLST lcn, CLST len,
WARN_ON(!is_mft && bytes > NTFS3_RUN_MAX_BYTES); WARN_ON(!is_mft && bytes > NTFS3_RUN_MAX_BYTES);
new_ptr = ntfs_vmalloc(bytes); new_ptr = kvmalloc(bytes, GFP_KERNEL);
if (!new_ptr) if (!new_ptr)
return false; return false;
...@@ -399,7 +399,7 @@ bool run_add_entry(struct runs_tree *run, CLST vcn, CLST lcn, CLST len, ...@@ -399,7 +399,7 @@ bool run_add_entry(struct runs_tree *run, CLST vcn, CLST lcn, CLST len,
memcpy(r + 1, run->runs + index, memcpy(r + 1, run->runs + index,
sizeof(struct ntfs_run) * (run->count - index)); sizeof(struct ntfs_run) * (run->count - index));
ntfs_vfree(run->runs); kvfree(run->runs);
run->runs = new_ptr; run->runs = new_ptr;
run->allocated = bytes; run->allocated = bytes;
......
...@@ -468,9 +468,9 @@ static void init_once(void *foo) ...@@ -468,9 +468,9 @@ static void init_once(void *foo)
/* noinline to reduce binary size*/ /* noinline to reduce binary size*/
static noinline void put_ntfs(struct ntfs_sb_info *sbi) static noinline void put_ntfs(struct ntfs_sb_info *sbi)
{ {
ntfs_free(sbi->new_rec); kfree(sbi->new_rec);
ntfs_vfree(ntfs_put_shared(sbi->upcase)); kvfree(ntfs_put_shared(sbi->upcase));
ntfs_free(sbi->def_table); kfree(sbi->def_table);
wnd_close(&sbi->mft.bitmap); wnd_close(&sbi->mft.bitmap);
wnd_close(&sbi->used.bitmap); wnd_close(&sbi->used.bitmap);
...@@ -496,14 +496,14 @@ static noinline void put_ntfs(struct ntfs_sb_info *sbi) ...@@ -496,14 +496,14 @@ static noinline void put_ntfs(struct ntfs_sb_info *sbi)
indx_clear(&sbi->security.index_sdh); indx_clear(&sbi->security.index_sdh);
indx_clear(&sbi->reparse.index_r); indx_clear(&sbi->reparse.index_r);
indx_clear(&sbi->objid.index_o); indx_clear(&sbi->objid.index_o);
ntfs_free(sbi->compress.lznt); kfree(sbi->compress.lznt);
#ifdef CONFIG_NTFS3_LZX_XPRESS #ifdef CONFIG_NTFS3_LZX_XPRESS
xpress_free_decompressor(sbi->compress.xpress); xpress_free_decompressor(sbi->compress.xpress);
lzx_free_decompressor(sbi->compress.lzx); lzx_free_decompressor(sbi->compress.lzx);
#endif #endif
clear_mount_options(&sbi->options); clear_mount_options(&sbi->options);
ntfs_free(sbi); kfree(sbi);
} }
static void ntfs_put_super(struct super_block *sb) static void ntfs_put_super(struct super_block *sb)
...@@ -848,7 +848,7 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size, ...@@ -848,7 +848,7 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,
sbi->used.bitmap.nbits = clusters; sbi->used.bitmap.nbits = clusters;
rec = ntfs_zalloc(record_size); rec = kzalloc(record_size, GFP_NOFS);
if (!rec) { if (!rec) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -915,7 +915,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -915,7 +915,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
ref.high = 0; ref.high = 0;
sbi = ntfs_zalloc(sizeof(struct ntfs_sb_info)); sbi = kzalloc(sizeof(struct ntfs_sb_info), GFP_NOFS);
if (!sbi) if (!sbi)
return -ENOMEM; return -ENOMEM;
...@@ -1181,7 +1181,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1181,7 +1181,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
goto out; goto out;
} }
bytes = inode->i_size; bytes = inode->i_size;
sbi->def_table = t = ntfs_malloc(bytes); sbi->def_table = t = kmalloc(bytes, GFP_NOFS);
if (!t) { if (!t) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -1247,7 +1247,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1247,7 +1247,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
goto out; goto out;
} }
sbi->upcase = upcase = ntfs_vmalloc(0x10000 * sizeof(short)); sbi->upcase = upcase = kvmalloc(0x10000 * sizeof(short), GFP_KERNEL);
if (!upcase) { if (!upcase) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -1277,7 +1277,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1277,7 +1277,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent)
shared = ntfs_set_shared(upcase, 0x10000 * sizeof(short)); shared = ntfs_set_shared(upcase, 0x10000 * sizeof(short));
if (shared && upcase != shared) { if (shared && upcase != shared) {
sbi->upcase = shared; sbi->upcase = shared;
ntfs_vfree(upcase); kvfree(upcase);
} }
iput(inode); iput(inode);
......
...@@ -110,7 +110,7 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea, ...@@ -110,7 +110,7 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea,
return -EFBIG; return -EFBIG;
/* Allocate memory for packed Ea */ /* Allocate memory for packed Ea */
ea_p = ntfs_malloc(size + add_bytes); ea_p = kmalloc(size + add_bytes, GFP_NOFS);
if (!ea_p) if (!ea_p)
return -ENOMEM; return -ENOMEM;
...@@ -142,7 +142,7 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea, ...@@ -142,7 +142,7 @@ static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea,
return 0; return 0;
out: out:
ntfs_free(ea_p); kfree(ea_p);
*ea = NULL; *ea = NULL;
return err; return err;
} }
...@@ -193,7 +193,7 @@ static ssize_t ntfs_list_ea(struct ntfs_inode *ni, char *buffer, ...@@ -193,7 +193,7 @@ static ssize_t ntfs_list_ea(struct ntfs_inode *ni, char *buffer,
} }
out: out:
ntfs_free(ea_all); kfree(ea_all);
return err ? err : ret; return err ? err : ret;
} }
...@@ -251,7 +251,7 @@ static int ntfs_get_ea(struct inode *inode, const char *name, size_t name_len, ...@@ -251,7 +251,7 @@ static int ntfs_get_ea(struct inode *inode, const char *name, size_t name_len,
err = 0; err = 0;
out: out:
ntfs_free(ea_all); kfree(ea_all);
if (!required) if (!required)
ni_unlock(ni); ni_unlock(ni);
...@@ -352,7 +352,7 @@ static noinline int ntfs_set_ea(struct inode *inode, const char *name, ...@@ -352,7 +352,7 @@ static noinline int ntfs_set_ea(struct inode *inode, const char *name,
} }
if (!ea_all) { if (!ea_all) {
ea_all = ntfs_zalloc(add); ea_all = kzalloc(add, GFP_NOFS);
if (!ea_all) { if (!ea_all) {
err = -ENOMEM; err = -ENOMEM;
goto out; goto out;
...@@ -474,7 +474,7 @@ static noinline int ntfs_set_ea(struct inode *inode, const char *name, ...@@ -474,7 +474,7 @@ static noinline int ntfs_set_ea(struct inode *inode, const char *name,
ni_unlock(ni); ni_unlock(ni);
run_close(&ea_run); run_close(&ea_run);
ntfs_free(ea_all); kfree(ea_all);
return err; return err;
} }
...@@ -599,7 +599,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, ...@@ -599,7 +599,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
value = NULL; value = NULL;
} else { } else {
size = posix_acl_xattr_size(acl->a_count); size = posix_acl_xattr_size(acl->a_count);
value = ntfs_malloc(size); value = kmalloc(size, GFP_NOFS);
if (!value) if (!value)
return -ENOMEM; return -ENOMEM;
...@@ -614,7 +614,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, ...@@ -614,7 +614,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
set_cached_acl(inode, type, acl); set_cached_acl(inode, type, acl);
out: out:
ntfs_free(value); kfree(value);
return err; return err;
} }
...@@ -880,7 +880,7 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de, ...@@ -880,7 +880,7 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de,
err = sd_size; err = sd_size;
memcpy(buffer, sd, sd_size); memcpy(buffer, sd, sd_size);
} }
ntfs_free(sd); kfree(sd);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment