diff options
Diffstat (limited to 'fs/notify')
-rw-r--r-- | fs/notify/inotify/inotify_user.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 0e781bc88d1e..b547ae17b461 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -180,7 +180,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, | |||
180 | struct fsnotify_event_private_data *fsn_priv; | 180 | struct fsnotify_event_private_data *fsn_priv; |
181 | struct inotify_event_private_data *priv; | 181 | struct inotify_event_private_data *priv; |
182 | size_t event_size = sizeof(struct inotify_event); | 182 | size_t event_size = sizeof(struct inotify_event); |
183 | size_t name_len; | 183 | size_t name_len = 0; |
184 | 184 | ||
185 | /* we get the inotify watch descriptor from the event private data */ | 185 | /* we get the inotify watch descriptor from the event private data */ |
186 | spin_lock(&event->lock); | 186 | spin_lock(&event->lock); |
@@ -196,10 +196,12 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, | |||
196 | inotify_free_event_priv(fsn_priv); | 196 | inotify_free_event_priv(fsn_priv); |
197 | } | 197 | } |
198 | 198 | ||
199 | /* round up event->name_len so it is a multiple of event_size | 199 | /* |
200 | * round up event->name_len so it is a multiple of event_size | ||
200 | * plus an extra byte for the terminating '\0'. | 201 | * plus an extra byte for the terminating '\0'. |
201 | */ | 202 | */ |
202 | name_len = roundup(event->name_len + 1, event_size); | 203 | if (event->name_len) |
204 | name_len = roundup(event->name_len + 1, event_size); | ||
203 | inotify_event.len = name_len; | 205 | inotify_event.len = name_len; |
204 | 206 | ||
205 | inotify_event.mask = inotify_mask_to_arg(event->mask); | 207 | inotify_event.mask = inotify_mask_to_arg(event->mask); |