Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Squashfs: fix f_pos check in get_dir_index_using_offset

One off error in the f_pos check. If f_pos is 3 or less don't
bother reading the index because we're at the start of the
directory, and we obviously already know where that is on disk.

This eliminates an unnecessary read.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>

+1 -1
+1 -1
fs/squashfs/dir.c
··· 64 64 * is offset by 3 because we invent "." and ".." entries which are 65 65 * not actually stored in the directory. 66 66 */ 67 - if (f_pos < 3) 67 + if (f_pos <= 3) 68 68 return f_pos; 69 69 f_pos -= 3; 70 70