kernel_samsung_a53x/fs/cifs
Kees Cook f59074fb01 smb3: Replace smb2pdu 1-element arrays with flex-arrays
commit eb3e28c1e89b4984308777231887e41aa8a0151f upstream.

The kernel is globally removing the ambiguous 0-length and 1-element
arrays in favor of flexible arrays, so that we can gain both compile-time
and run-time array bounds checking[1].

Replace the trailing 1-element array with a flexible array in the
following structures:

        struct smb2_err_rsp
        struct smb2_tree_connect_req
        struct smb2_negotiate_rsp
        struct smb2_sess_setup_req
        struct smb2_sess_setup_rsp
        struct smb2_read_req
        struct smb2_read_rsp
        struct smb2_write_req
        struct smb2_write_rsp
        struct smb2_query_directory_req
        struct smb2_query_directory_rsp
        struct smb2_set_info_req
        struct smb2_change_notify_rsp
        struct smb2_create_rsp
        struct smb2_query_info_req
        struct smb2_query_info_rsp

Replace the trailing 1-element array with a flexible array, but leave
the existing structure padding:

        struct smb2_file_all_info
        struct smb2_lock_req

Adjust all related size calculations to match the changes to sizeof().

No machine code output or .data section differences are produced after
these changes.

[1] For lots of details, see both:
    https://docs.kernel.org/process/deprecated.html#zero-length-and-one-element-arrays
    https://people.kernel.org/kees/bounded-flexible-arrays-in-c

Cc: Steve French <sfrench@samba.org>
Cc: Paulo Alcantara <pc@cjr.nz>
Cc: Ronnie Sahlberg <lsahlber@redhat.com>
Cc: Shyam Prasad N <sprasad@microsoft.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-18 12:12:59 +01:00
..
asn1.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_debug.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_dfs_ref.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_fs_sb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_ioctl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_spnego.c cifs: spnego: add ';' in HOST_KEY_LEN 2024-11-18 11:43:20 +01:00
cifs_spnego.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_unicode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_unicode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifs_uniupr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsacl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsacl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsencrypt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsfs.c cifs: Fix non-availability of dedup breaking generic/304 2024-11-18 12:11:47 +01:00
cifsfs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsglob.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifspdu.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsproto.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifsroot.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cifssmb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
connect.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dfs_cache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dfs_cache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dir.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dns_resolve.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dns_resolve.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
export.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
file.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fs_context.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fs_context.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fscache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fscache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ioctl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
link.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
misc.c smb: client: fix OOB in smbCalcSize() 2024-11-18 12:12:02 +01:00
netmisc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nterr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nterr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ntlmssp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
readdir.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rfc1002pdu.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sess.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb1ops.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2file.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2glob.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2inode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2maperror.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2misc.c smb3: Replace smb2pdu 1-element arrays with flex-arrays 2024-11-18 12:12:59 +01:00
smb2ops.c smb3: Replace smb2pdu 1-element arrays with flex-arrays 2024-11-18 12:12:59 +01:00
smb2pdu.c smb3: Replace smb2pdu 1-element arrays with flex-arrays 2024-11-18 12:12:59 +01:00
smb2pdu.h smb3: Replace smb2pdu 1-element arrays with flex-arrays 2024-11-18 12:12:59 +01:00
smb2proto.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2status.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smb2transport.c cifs: fix check of rc in function generate_smb3signingkey 2024-11-18 11:43:20 +01:00
smbdirect.c smbdirect: missing rc checks while waiting for rdma events 2024-11-18 10:58:32 +01:00
smbdirect.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smbencrypt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smberr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smbfsctl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trace.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
trace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
transport.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
winucase.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xattr.c smb3: fix caching of ctime on setxattr 2024-11-18 12:11:13 +01:00