inotify: fix length reporting and size checking

0db501bd0610ee0c0 introduced a regresion in that it now sends a nul
terminator but the length accounting when checking for space or
reporting to userspace did not take this into account. This corrects
all of the rounding logic.

Signed-off-by: Eric Paris <eparis@redhat.com>

+5 -3
+5 -3
fs/notify/inotify/inotify_user.c
··· 154 154 155 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 160 if (event_size > count) 160 161 return ERR_PTR(-EINVAL); ··· 328 327 list_for_each_entry(holder, &group->notification_list, event_list) { 329 328 event = holder->event; 330 329 send_len += sizeof(struct inotify_event); 331 - send_len += roundup(event->name_len, 332 - sizeof(struct inotify_event)); 330 + if (event->name_len) 331 + send_len += roundup(event->name_len + 1, 332 + sizeof(struct inotify_event)); 333 333 } 334 334 mutex_unlock(&group->notification_mutex); 335 335 ret = put_user(send_len, (int __user *) p);