aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/notify/inotify/inotify_user.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index b547ae17b461..6111670b2573 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -154,7 +154,8 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
154 154
155 event = fsnotify_peek_notify_event(group); 155 event = fsnotify_peek_notify_event(group);
156 156
157 event_size += roundup(event->name_len, event_size); 157 if (event->name_len)
158 event_size += roundup(event->name_len + 1, event_size);
158 159
159 if (event_size > count) 160 if (event_size > count)
160 return ERR_PTR(-EINVAL); 161 return ERR_PTR(-EINVAL);
@@ -327,8 +328,9 @@ static long inotify_ioctl(struct file *file, unsigned int cmd,
327 list_for_each_entry(holder, &group->notification_list, event_list) { 328 list_for_each_entry(holder, &group->notification_list, event_list) {
328 event = holder->event; 329 event = holder->event;
329 send_len += sizeof(struct inotify_event); 330 send_len += sizeof(struct inotify_event);
330 send_len += roundup(event->name_len, 331 if (event->name_len)
331 sizeof(struct inotify_event)); 332 send_len += roundup(event->name_len + 1,
333 sizeof(struct inotify_event));
332 } 334 }
333 mutex_unlock(&group->notification_mutex); 335 mutex_unlock(&group->notification_mutex);
334 ret = put_user(send_len, (int __user *) p); 336 ret = put_user(send_len, (int __user *) p);