summaryrefslogtreecommitdiff
path: root/fs/smb
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2024-09-27 16:36:42 +0200
committerSteve French <stfrench@microsoft.com>2024-10-01 14:50:51 -0500
commit04afb0a3c30aeb5fbe890a92debbfc0cc4044b6f (patch)
tree1a91312e9dcb42ae4a9989a9a633be757c2b1427 /fs/smb
parent9852d85ec9d492ebef56dc5f229416c925758edc (diff)
ksmbd: Use struct_size() to improve get_file_alternate_info()
Use struct_size() to calculate the output buffer length. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb')
-rw-r--r--fs/smb/server/smb2pdu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 7460089c186f..f28346fad894 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -4883,7 +4883,7 @@ static void get_file_alternate_info(struct ksmbd_work *work,
spin_unlock(&dentry->d_lock);
file_info->FileNameLength = cpu_to_le32(conv_len);
rsp->OutputBufferLength =
- cpu_to_le32(sizeof(struct smb2_file_alt_name_info) + conv_len);
+ cpu_to_le32(struct_size(file_info, FileName, conv_len));
}
static int get_file_stream_info(struct ksmbd_work *work,