mirror of
https://github.com/torvalds/linux.git
synced 2026-10-13 13:51:03 +02:00
ksmbd: remove extra byte from ipc_msg_alloc() size calculations
Three ipc_msg_alloc() calls in transport_ipc.c allocate sizeof(struct) + payload_len + 1, but the extra byte is unnecessary. The payload data is binary and copied with memcpy() to the exact size; no null terminator is needed. This was present in the original commit that introduced the file, where the structs already used [0] zero-length arrays, so the +1 was never correct. Assisted-by: Opencode:Big-Pickle Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
16a7f7c2ec
commit
6eac877e0e
|
|
@ -679,7 +679,7 @@ ksmbd_ipc_spnego_authen_request(const char *spnego_blob, int blob_len)
|
|||
return NULL;
|
||||
|
||||
msg = ipc_msg_alloc(sizeof(struct ksmbd_spnego_authen_request) +
|
||||
blob_len + 1);
|
||||
blob_len);
|
||||
if (!msg)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -860,7 +860,7 @@ struct ksmbd_rpc_command *ksmbd_rpc_write(struct ksmbd_session *sess, int handle
|
|||
if (payload_sz > KSMBD_IPC_MAX_PAYLOAD)
|
||||
return NULL;
|
||||
|
||||
msg = ipc_msg_alloc(sizeof(struct ksmbd_rpc_command) + payload_sz + 1);
|
||||
msg = ipc_msg_alloc(sizeof(struct ksmbd_rpc_command) + payload_sz);
|
||||
if (!msg)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -919,7 +919,7 @@ struct ksmbd_rpc_command *ksmbd_rpc_ioctl(struct ksmbd_session *sess, int handle
|
|||
if (payload_sz > KSMBD_IPC_MAX_PAYLOAD)
|
||||
return NULL;
|
||||
|
||||
msg = ipc_msg_alloc(sizeof(struct ksmbd_rpc_command) + payload_sz + 1);
|
||||
msg = ipc_msg_alloc(sizeof(struct ksmbd_rpc_command) + payload_sz);
|
||||
if (!msg)
|
||||
return NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user