Skip to content

Commit 5211cc8

Browse files
GustavoARSilvaSteve French
authored andcommitted
ksmbd: Use struct_size() helper in ksmbd_negotiate_smb_dialect()
Prefer struct_size() over open-coded versions. Link: KSPP/linux#160 Signed-off-by: Gustavo A. R. Silva <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Namjae Jeon <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 7b7d709 commit 5211cc8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/smb/server/smb_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static int ksmbd_negotiate_smb_dialect(void *buf)
266266
if (smb2_neg_size > smb_buf_length)
267267
goto err_out;
268268

269-
if (smb2_neg_size + le16_to_cpu(req->DialectCount) * sizeof(__le16) >
269+
if (struct_size(req, Dialects, le16_to_cpu(req->DialectCount)) >
270270
smb_buf_length)
271271
goto err_out;
272272

0 commit comments

Comments
 (0)