Skip to content

Commit 223e228

Browse files
harsha-broadcomPaolo Abeni
authored andcommitted
vsock/vmci: Clear the vmci transport packet properly when initializing it
In vmci_transport_packet_init memset the vmci_transport_packet before populating the fields to avoid any uninitialised data being left in the structure. Cc: Bryan Tan <[email protected]> Cc: Vishnu Dasa <[email protected]> Cc: Broadcom internal kernel review list Cc: Stefano Garzarella <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Jakub Kicinski <[email protected]> Cc: Paolo Abeni <[email protected]> Cc: Simon Horman <[email protected]> Cc: [email protected] Cc: [email protected] Cc: stable <[email protected]> Signed-off-by: HarshaVardhana S A <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Fixes: d021c34 ("VSOCK: Introduce VM Sockets") Acked-by: Stefano Garzarella <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent f030713 commit 223e228

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/vmw_vsock/vmci_transport.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ vmci_transport_packet_init(struct vmci_transport_packet *pkt,
119119
u16 proto,
120120
struct vmci_handle handle)
121121
{
122+
memset(pkt, 0, sizeof(*pkt));
123+
122124
/* We register the stream control handler as an any cid handle so we
123125
* must always send from a source address of VMADDR_CID_ANY
124126
*/
@@ -131,8 +133,6 @@ vmci_transport_packet_init(struct vmci_transport_packet *pkt,
131133
pkt->type = type;
132134
pkt->src_port = src->svm_port;
133135
pkt->dst_port = dst->svm_port;
134-
memset(&pkt->proto, 0, sizeof(pkt->proto));
135-
memset(&pkt->_reserved2, 0, sizeof(pkt->_reserved2));
136136

137137
switch (pkt->type) {
138138
case VMCI_TRANSPORT_PACKET_TYPE_INVALID:

0 commit comments

Comments
 (0)