[XFS] Fix oops in xfs_file_readdir()

When xfs_file_readdir() exactly fills a buffer, it can move it's index
past the end of the buffer and dereference it even though the result of
the dereference is never used. On some platforms this causes an oops.

SGI-PV: 976923
SGI-Modid: xfs-linux-melb:xfs-kern:30458a

Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>

authored by David Chinner and committed by Lachlan McIlroy 450790a2 cbc89dcf

+1 -2
+1 -2
fs/xfs/linux-2.6/xfs_file.c
··· 350 351 size = buf.used; 352 de = (struct hack_dirent *)buf.dirent; 353 - curr_offset = de->offset /* & 0x7fffffff */; 354 while (size > 0) { 355 if (filldir(dirent, de->name, de->namlen, 356 curr_offset & 0x7fffffff, 357 de->ino, de->d_type)) { ··· 362 sizeof(u64)); 363 size -= reclen; 364 de = (struct hack_dirent *)((char *)de + reclen); 365 - curr_offset = de->offset /* & 0x7fffffff */; 366 } 367 } 368
··· 350 351 size = buf.used; 352 de = (struct hack_dirent *)buf.dirent; 353 while (size > 0) { 354 + curr_offset = de->offset /* & 0x7fffffff */; 355 if (filldir(dirent, de->name, de->namlen, 356 curr_offset & 0x7fffffff, 357 de->ino, de->d_type)) { ··· 362 sizeof(u64)); 363 size -= reclen; 364 de = (struct hack_dirent *)((char *)de + reclen); 365 } 366 } 367