Skip to content

Commit

Permalink
ksmbd: Use struct_size() to improve get_file_alternate_info()
Browse files Browse the repository at this point in the history
Use struct_size() to calculate the output buffer length.

Signed-off-by: Thorsten Blum <[email protected]>
Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
toblux authored and namjaejeon committed Oct 13, 2024
1 parent b6d0945 commit 9ae66f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5141,7 +5141,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,
Expand Down

0 comments on commit 9ae66f9

Please sign in to comment.