* [PATCH] ksmbd: Use struct_size() to improve get_file_alternate_info()
@ 2024-09-27 14:36 Thorsten Blum
2024-09-28 0:43 ` Namjae Jeon
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2024-09-27 14:36 UTC (permalink / raw)
To: Namjae Jeon, Steve French, Sergey Senozhatsky, Tom Talpey
Cc: Thorsten Blum, linux-cifs, linux-kernel
Use struct_size() to calculate the output buffer length.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
fs/smb/server/smb2pdu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 7121266daa02..b45e5b9ad967 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -4887,7 +4887,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,
--
2.46.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ksmbd: Use struct_size() to improve get_file_alternate_info()
2024-09-27 14:36 [PATCH] ksmbd: Use struct_size() to improve get_file_alternate_info() Thorsten Blum
@ 2024-09-28 0:43 ` Namjae Jeon
0 siblings, 0 replies; 2+ messages in thread
From: Namjae Jeon @ 2024-09-28 0:43 UTC (permalink / raw)
To: Thorsten Blum
Cc: Steve French, Sergey Senozhatsky, Tom Talpey, linux-cifs,
linux-kernel
On Fri, Sep 27, 2024 at 11:37 PM Thorsten Blum <thorsten.blum@linux.dev> wrote:
>
> Use struct_size() to calculate the output buffer length.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Applied it to #ksmbd-for-next-next.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-28 0:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27 14:36 [PATCH] ksmbd: Use struct_size() to improve get_file_alternate_info() Thorsten Blum
2024-09-28 0:43 ` Namjae Jeon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.