mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
ksmbd: Use struct_size() helper in ksmbd_negotiate_smb_dialect()
[ Upstream commit 5211cc8727 ]
Prefer struct_size() over open-coded versions.
Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e7ab53bd81
commit
63fbfd212c
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user