[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090809215941.26204.52486.stgit@paris.rdu.redhat.com>
Date: Sun, 09 Aug 2009 17:59:42 -0400
From: Eric Paris <eparis@...hat.com>
To: linux-kernel@...r.kernel.org, viro@...IV.linux.org.uk
Subject: [PATCH 2/5] inotify: use ZERO_PAGE instead of private static
declaration
inotify needs to pad filenames to an inotify event length. Currently this
is done by copying 0s from an event declared globally. This patch doesn't
waste global address space just to have some 0s and instead uses
clear_user()
Signed-off-by: Eric Paris <eparis@...hat.com>
---
fs/notify/inotify/inotify_user.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index c17d5a3..c3086b0 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -47,9 +47,6 @@
static struct vfsmount *inotify_mnt __read_mostly;
-/* this just sits here and wastes global memory. used to just pad userspace messages with zeros */
-static struct inotify_event nul_inotify_event;
-
/* these are configurable via /proc/sys/fs/inotify/ */
static int inotify_max_user_instances __read_mostly;
static int inotify_max_queued_events __read_mostly;
@@ -215,7 +212,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
/*
* fsnotify only stores the pathname, so here we have to send the pathname
* and then pad that pathname out to a multiple of sizeof(inotify_event)
- * with zeros. I get my zeros from the nul_inotify_event.
+ * with zeros.
*/
if (name_len) {
unsigned int len_to_zero = name_len - event->name_len;
@@ -224,8 +221,8 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
return -EFAULT;
buf += event->name_len;
- /* fill userspace with 0's from nul_inotify_event */
- if (copy_to_user(buf, &nul_inotify_event, len_to_zero))
+ /* fill userspace with 0's */
+ if (clear_user(buf, len_to_zero))
return -EFAULT;
buf += len_to_zero;
event_size += name_len;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists