[Devel] [PATCH rh7 01/30] fs/file.c: don't open-code kvfree()

Kirill Tkhai ktkhai at virtuozzo.com
Wed May 20 19:02:59 MSK 2020


From: Al Viro <viro at zeniv.linux.org.uk>

ms commit f6c0a1920e01

Signed-off-by: Al Viro <viro at zeniv.linux.org.uk>
---
 fs/file.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/fs/file.c b/fs/file.c
index 84c8d695c0d3..d1a54c9a8ecf 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -45,15 +45,10 @@ static void *alloc_fdmem(size_t size)
 	return __vmalloc(size, GFP_KERNEL_ACCOUNT | __GFP_HIGHMEM, PAGE_KERNEL);
 }
 
-static void free_fdmem(void *ptr)
-{
-	is_vmalloc_addr(ptr) ? vfree(ptr) : kfree(ptr);
-}
-
 static void __free_fdtable(struct fdtable *fdt)
 {
-	free_fdmem(fdt->fd);
-	free_fdmem(fdt->open_fds);
+	kvfree(fdt->fd);
+	kvfree(fdt->open_fds);
 	kfree(fdt);
 }
 
@@ -166,7 +161,7 @@ static struct fdtable * alloc_fdtable(unsigned int nr)
 	return fdt;
 
 out_arr:
-	free_fdmem(fdt->fd);
+	kvfree(fdt->fd);
 out_fdt:
 	kfree(fdt);
 out:




More information about the Devel mailing list