Skip to content

Commit 04afb0a

Browse files
tobluxSteve French
authored andcommitted
ksmbd: Use struct_size() to improve get_file_alternate_info()
Use struct_size() to calculate the output buffer length. Signed-off-by: Thorsten Blum <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 9852d85 commit 04afb0a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/smb/server/smb2pdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4883,7 +4883,7 @@ static void get_file_alternate_info(struct ksmbd_work *work,
48834883
spin_unlock(&dentry->d_lock);
48844884
file_info->FileNameLength = cpu_to_le32(conv_len);
48854885
rsp->OutputBufferLength =
4886-
cpu_to_le32(sizeof(struct smb2_file_alt_name_info) + conv_len);
4886+
cpu_to_le32(struct_size(file_info, FileName, conv_len));
48874887
}
48884888

48894889
static int get_file_stream_info(struct ksmbd_work *work,

0 commit comments

Comments
 (0)