diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index a8602729586a..09a24c81dc7d 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c @@ -317,7 +317,7 @@ struct nilfs_dir_entry *nilfs_find_entry(struct inode *dir, de = (struct nilfs_dir_entry *)kaddr; kaddr += nilfs_last_byte(dir, n) - reclen; - while ((char *)de <= kaddr) { + while ((char *)de + sizeof(*de) <= kaddr) { if (de->rec_len == 0) { nilfs_error(dir->i_sb, "zero-length directory entry");