Skip to content

Commit

Permalink
fsnotify/fdinfo: use named constants instead of hardcoded values
Browse files Browse the repository at this point in the history
MAX_HANDLE_SZ is equal to 128, but currently the size of pad is only 64
bytes, so exportfs_encode_inode_fh can return an error.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
avagin authored and torvalds committed Sep 10, 2014
1 parent acbbe6f commit 1fc98d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/notify/fdinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ static int show_mark_fhandle(struct seq_file *m, struct inode *inode)
{
struct {
struct file_handle handle;
u8 pad[64];
u8 pad[MAX_HANDLE_SZ];
} f;
int size, ret, i;

f.handle.handle_bytes = sizeof(f.pad);
size = f.handle.handle_bytes >> 2;

ret = exportfs_encode_inode_fh(inode, (struct fid *)f.handle.f_handle, &size, 0);
if ((ret == 255) || (ret == -ENOSPC)) {
if ((ret == FILEID_INVALID) || (ret == -ENOSPC)) {
WARN_ONCE(1, "Can't encode file handler for inotify: %d\n", ret);
return 0;
}
Expand Down

0 comments on commit 1fc98d1

Please sign in to comment.