WSL2-Linux-Kernel/fs
Linus Torvalds b7213ffa0e qnx4: avoid stringop-overread errors
The qnx4 directory entries are 64-byte blocks that have different
contents depending on the a status byte that is in the last byte of the
block.

In particular, a directory entry can be either a "link info" entry with
a 48-byte name and pointers to the real inode information, or an "inode
entry" with a smaller 16-byte name and the full inode information.

But the code was written to always just treat the directory name as if
it was part of that "inode entry", and just extend the name to the
longer case if the status byte said it was a link entry.

That work just fine and gives the right results, but now that gcc is
tracking data structure accesses much more, the code can trigger a
compiler error about using up to 48 bytes (the long name) in a structure
that only has that shorter name in it:

   fs/qnx4/dir.c: In function ‘qnx4_readdir’:
   fs/qnx4/dir.c:51:32: error: ‘strnlen’ specified bound 48 exceeds source size 16 [-Werror=stringop-overread]
      51 |                         size = strnlen(de->di_fname, size);
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from fs/qnx4/qnx4.h:3,
                    from fs/qnx4/dir.c:16:
   include/uapi/linux/qnx4_fs.h:45:25: note: source object declared here
      45 |         char            di_fname[QNX4_SHORT_NAME_MAX];
         |                         ^~~~~~~~

which is because the source code doesn't really make this whole "one of
two different types" explicit.

Fix this by introducing a very explicit union of the two types, and
basically explaining to the compiler what is really going on.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-09-15 13:56:37 -07:00
..
9p
adfs
affs
afs
autofs
befs
bfs
btrfs for-5.15-tag 2021-09-09 16:09:56 -07:00
cachefiles
ceph We have: 2021-09-08 15:50:32 -07:00
cifs cifs: properly invalidate cached root handle when closing it 2021-09-09 17:34:38 -05:00
coda
configfs
cramfs
crypto
debugfs
devpts
dlm
ecryptfs
efivarfs
efs
erofs libnvdimm for v5.15 2021-09-09 11:39:57 -07:00
exfat
exportfs
ext2 libnvdimm for v5.15 2021-09-09 11:39:57 -07:00
ext4 libnvdimm for v5.15 2021-09-09 11:39:57 -07:00
f2fs
fat
freevxfs
fscache
fuse fuse update for 5.15 2021-09-07 12:18:29 -07:00
gfs2 Merge branch 'work.gfs2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2021-09-09 12:45:26 -07:00
hfs
hfsplus
hostfs
hpfs
hugetlbfs
iomap
isofs
jbd2
jffs2
jfs
kernfs
ksmbd ksmbd: fix control flow issues in sid_to_id() 2021-09-08 17:16:13 -05:00
lockd
minix
netfs
nfs
nfs_common
nfsd
nilfs2 Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
nls
notify fsnotify: fix sb_connectors leak 2021-09-10 09:46:48 -07:00
ntfs
ntfs3
ocfs2
omfs
openpromfs
orangefs
overlayfs
proc Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
pstore
qnx4 qnx4: avoid stringop-overread errors 2021-09-15 13:56:37 -07:00
qnx6
quota
ramfs
reiserfs
romfs
smbfs_common cifs: move SMB FSCTL definitions to common code 2021-09-09 00:09:20 -05:00
squashfs
sysfs
sysv
tracefs
ubifs
udf
ufs
unicode
vboxsf
verity
xfs libnvdimm for v5.15 2021-09-09 11:39:57 -07:00
zonefs
Kconfig 4 cifs/smb3 fixes, one for DFS reconnect, and one to begin creating common headers for server and client and the other two to rename the cifs_common directory to smbfs_common to be more consistent ie change use of the name cifs to smb which is more accurate 2021-09-12 10:10:21 -07:00
Kconfig.binfmt
Makefile 4 cifs/smb3 fixes, one for DFS reconnect, and one to begin creating common headers for server and client and the other two to rename the cifs_common directory to smbfs_common to be more consistent ie change use of the name cifs to smb which is more accurate 2021-09-12 10:10:21 -07:00
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c
binfmt_elf_fdpic.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
buffer.c
char_dev.c
compat_binfmt_elf.c
coredump.c coredump: fix memleak in dump_vma_snapshot() 2021-09-08 11:50:27 -07:00
d_path.c
dax.c
dcache.c
direct-io.c
drop_caches.c
eventfd.c
eventpoll.c ARM development updates for 5.15: 2021-09-09 13:25:49 -07:00
exec.c
fcntl.c
fhandle.c
file.c virtio,vdpa,vhost: features, fixes 2021-09-11 14:48:42 -07:00
file_table.c
filesystems.c
fs-writeback.c
fs_context.c
fs_parser.c namei: Standardize callers of filename_lookup() 2021-09-07 16:07:47 -04:00
fs_pin.c
fs_struct.c
fs_types.c
fsopen.c
init.c
inode.c
internal.h block: move fs/block_dev.c to block/bdev.c 2021-09-07 08:39:40 -06:00
io-wq.c io-wq: fix memory leak in create_io_worker() 2021-09-09 06:57:04 -06:00
io-wq.h
io_uring.c io_uring-5.15-2021-09-11 2021-09-11 10:28:14 -07:00
ioctl.c
kernel_read_file.c
libfs.c
locks.c Revert "memcg: enable accounting for file lock caches" 2021-09-07 11:21:48 -07:00
mbcache.c
mount.h
mpage.c
namei.c putname(): IS_ERR_OR_NULL() is wrong here 2021-09-07 16:14:05 -04:00
namespace.c
no-block.c
nsfs.c
open.c
pipe.c Revert "mm/gup: remove try_get_page(), call try_get_compound_head() directly" 2021-09-07 11:03:45 -07:00
pnode.c
pnode.h
posix_acl.c
proc_namespace.c
read_write.c
readdir.c
remap_range.c
select.c Revert "memcg: enable accounting for pollfd and select bits arrays" 2021-09-07 11:26:23 -07:00
seq_file.c
signalfd.c
splice.c
stack.c
stat.c
statfs.c
super.c
sync.c
timerfd.c
userfaultfd.c
utimes.c
xattr.c