Skip to content

Commit 8bb04fb

Browse files
tobluxsmfrench
authored andcommitted
ksmbd: Replace one-element arrays with flexible-array members
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: KSPP#79 Signed-off-by: Thorsten Blum <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 289ebd9 commit 8bb04fb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

fs/smb/server/smb2pdu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4587,7 +4587,7 @@ static int smb2_get_ea(struct ksmbd_work *work, struct ksmbd_file *fp,
45874587
path = &fp->filp->f_path;
45884588
/* single EA entry is requested with given user.* name */
45894589
if (req->InputBufferLength) {
4590-
if (le32_to_cpu(req->InputBufferLength) <
4590+
if (le32_to_cpu(req->InputBufferLength) <=
45914591
sizeof(struct smb2_ea_info_req))
45924592
return -EINVAL;
45934593

@@ -8091,7 +8091,7 @@ int smb2_ioctl(struct ksmbd_work *work)
80918091
goto out;
80928092
}
80938093

8094-
if (in_buf_len < sizeof(struct copychunk_ioctl_req)) {
8094+
if (in_buf_len <= sizeof(struct copychunk_ioctl_req)) {
80958095
ret = -EINVAL;
80968096
goto out;
80978097
}

fs/smb/server/smb2pdu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ struct copychunk_ioctl_req {
194194
__le64 ResumeKey[3];
195195
__le32 ChunkCount;
196196
__le32 Reserved;
197-
__u8 Chunks[1]; /* array of srv_copychunk */
197+
__u8 Chunks[]; /* array of srv_copychunk */
198198
} __packed;
199199

200200
struct srv_copychunk {
@@ -370,7 +370,7 @@ struct smb2_file_attr_tag_info {
370370
struct smb2_ea_info_req {
371371
__le32 NextEntryOffset;
372372
__u8 EaNameLength;
373-
char name[1];
373+
char name[];
374374
} __packed; /* level 15 Query */
375375

376376
struct smb2_ea_info {

0 commit comments

Comments
 (0)