Commit 5211cc87 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Steve French

ksmbd: Use struct_size() helper in ksmbd_negotiate_smb_dialect()

Prefer struct_size() over open-coded versions.

Link: https://github.com/KSPP/linux/issues/160Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Acked-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 7b7d709e
......@@ -266,7 +266,7 @@ static int ksmbd_negotiate_smb_dialect(void *buf)
if (smb2_neg_size > smb_buf_length)
goto err_out;
if (smb2_neg_size + le16_to_cpu(req->DialectCount) * sizeof(__le16) >
if (struct_size(req, Dialects, le16_to_cpu(req->DialectCount)) >
smb_buf_length)
goto err_out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment