ksmbd: Replace one-element arrays with flexible-array members
authorThorsten Blum <thorsten.blum@toblux.com>
Tue, 20 Aug 2024 19:15:20 +0000 (21:15 +0200)
committerSteve French <stfrench@microsoft.com>
Sat, 21 Sep 2024 03:16:11 +0000 (22:16 -0500)
Replace the deprecated one-element arrays with flexible-array members
in the structs copychunk_ioctl_req and smb2_ea_info_req.

There are no binary differences after this conversion.

Link: https://github.com/KSPP/linux/issues/79
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/smb2pdu.c
fs/smb/server/smb2pdu.h

index 28cd66fa8e05f17142ce9b0b802314df3dcf9a2e..7121266daa02044e211447aa7afea983832afe73 100644 (file)
@@ -4587,7 +4587,7 @@ static int smb2_get_ea(struct ksmbd_work *work, struct ksmbd_file *fp,
        path = &fp->filp->f_path;
        /* single EA entry is requested with given user.* name */
        if (req->InputBufferLength) {
-               if (le32_to_cpu(req->InputBufferLength) <
+               if (le32_to_cpu(req->InputBufferLength) <=
                    sizeof(struct smb2_ea_info_req))
                        return -EINVAL;
 
@@ -8091,7 +8091,7 @@ int smb2_ioctl(struct ksmbd_work *work)
                        goto out;
                }
 
-               if (in_buf_len < sizeof(struct copychunk_ioctl_req)) {
+               if (in_buf_len <= sizeof(struct copychunk_ioctl_req)) {
                        ret = -EINVAL;
                        goto out;
                }
index 3be7d5ae65a807dc9e4c880c9db71599155d76cd..73aff20e22d014ff129efda0f28ba53b0da87502 100644 (file)
@@ -194,7 +194,7 @@ struct copychunk_ioctl_req {
        __le64 ResumeKey[3];
        __le32 ChunkCount;
        __le32 Reserved;
-       __u8 Chunks[1]; /* array of srv_copychunk */
+       __u8 Chunks[]; /* array of srv_copychunk */
 } __packed;
 
 struct srv_copychunk {
@@ -370,7 +370,7 @@ struct smb2_file_attr_tag_info {
 struct smb2_ea_info_req {
        __le32 NextEntryOffset;
        __u8   EaNameLength;
-       char name[1];
+       char name[];
 } __packed; /* level 15 Query */
 
 struct smb2_ea_info {