summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-08-13 18:21:07 -0400
committerEric Paris <eparis@redhat.com>2009-08-19 09:54:40 -0400
commitf49cd1cbb92bc24e9a203779cd25fc7953661e6c (patch)
tree77797fa61022b9733adec651bf778ad951693c8c /fs
parent2305f29dcf8102115c1635385c2c2dbc3baba723 (diff)
inotify: use clear_user instead of a zero filled 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@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/notify/inotify/inotify_user.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index ca0f36bf9a3d..cf98e1b7d51d 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;