diff options
| author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2023-06-21 15:29:22 -0600 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2023-06-26 00:07:04 -0500 |
| commit | 5211cc8727ed9701b04976ab47602955e5641bda (patch) | |
| tree | 5ab3bd1e11f5badbb437f87530076748930273dd | |
| parent | ksmbd: add missing compound request handing in some commands (diff) | |
| download | linux-5211cc8727ed9701b04976ab47602955e5641bda.tar.gz linux-5211cc8727ed9701b04976ab47602955e5641bda.zip | |
ksmbd: Use struct_size() helper in ksmbd_negotiate_smb_dialect()
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>
| -rw-r--r-- | fs/smb/server/smb_common.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/smb/server/smb_common.c b/fs/smb/server/smb_common.c index a7e81067bc99..b51f431ade01 100644 --- a/fs/smb/server/smb_common.c +++ b/fs/smb/server/smb_common.c @@ -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; |
