[PATCH] net/bluetooth: use memset avoid memory leaks

Subsystems: bluetooth subsystem, the rest

STALE1647d

2 messages, 2 authors, 2022-03-04 · open the first message on its own page

[PATCH] net/bluetooth: use memset avoid memory leaks

From: <hidden>
Date: 2022-02-25 07:42:08

From: Minghao Chi (CGEL ZTE) <redacted>

Use memset to initialize structs to prevent memory leaks
in l2cap_ecred_connect

Reported-by: Zeal Robot <redacted>
Signed-off-by: Minghao Chi (CGEL ZTE) <redacted>
---
 net/bluetooth/l2cap_core.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index e817ff0607a0..8df99c07f272 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1436,6 +1436,7 @@ static void l2cap_ecred_connect(struct l2cap_chan *chan)
 
 	l2cap_ecred_init(chan, 0);
 
+	memset(&data, 0, sizeof(data));
 	data.pdu.req.psm     = chan->psm;
 	data.pdu.req.mtu     = cpu_to_le16(chan->imtu);
 	data.pdu.req.mps     = cpu_to_le16(chan->mps);
-- 
2.25.1

Re: [PATCH] net/bluetooth: use memset avoid memory leaks

From: Marcel Holtmann <marcel@holtmann.org>
Date: 2022-03-04 17:21:01

Hi Minghao,
Use memset to initialize structs to prevent memory leaks
in l2cap_ecred_connect

Reported-by: Zeal Robot <redacted>
Signed-off-by: Minghao Chi (CGEL ZTE) <redacted>
---
net/bluetooth/l2cap_core.c | 1 +
1 file changed, 1 insertion(+)
patch has been applied to bluetooth-next tree.

Regards

Marcel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help