Skip to contentSkip to conversation

emulator: Fix uninitiailzed scalar variable

PATCH In review Tedd Ho-Jeong An 2 participants 4 messages Nov 13, 2021 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 emulator: Fix uninitiailzed scalar variable

From: Tedd Ho-Jeong An <[email protected]>

This patch fixes the uninitiailzed varialble(CWE-457) reported by the Coverity scan.

---
 emulator/bthost.c | 3 +++
 1 file changed, 3 insertions(+)
emulator/bthost.c +3 -0
index 61f1cd361..66e337f34 100644
@@ -1570,6 +1570,7 @@ static void rfcomm_sabm_send(struct bthost *bthost, struct btconn *conn,
 {
 	struct rfcomm_cmd cmd;
 
+	memset(&cmd, 0, sizeof(cmd));
 	cmd.address = RFCOMM_ADDR(cr, dlci);
 	cmd.control = RFCOMM_CTRL(RFCOMM_SABM, 1);
 	cmd.length = RFCOMM_LEN8(0);
@@ -2123,6 +2124,7 @@ static void rfcomm_ua_send(struct bthost *bthost, struct btconn *conn,
 {
 	struct rfcomm_cmd cmd;
 
+	memset(&cmd, 0, sizeof(cmd));
 	cmd.address = RFCOMM_ADDR(cr, dlci);
 	cmd.control = RFCOMM_CTRL(RFCOMM_UA, 1);
 	cmd.length = RFCOMM_LEN8(0);
@@ -2136,6 +2138,7 @@ static void rfcomm_dm_send(struct bthost *bthost, struct btconn *conn,
 {
 	struct rfcomm_cmd cmd;
 
+	memset(&cmd, 0, sizeof(cmd));
 	cmd.address = RFCOMM_ADDR(cr, dlci);
 	cmd.control = RFCOMM_CTRL(RFCOMM_DM, 1);
 	cmd.length = RFCOMM_LEN8(0);
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/3 monitor: Fix uninitiailzed scalar variable

From: Tedd Ho-Jeong An <[email protected]>

This patch fixes the uninitiailzed varialble(CWE-457) reported by the Coverity scan.

---
 monitor/rfcomm.c | 1 +
 1 file changed, 1 insertion(+)
monitor/rfcomm.c +1 -0
index 41533b158..02300a8b5 100644
@@ -437,6 +437,7 @@ void rfcomm_packet(const struct l2cap_frame *frame)
 	if (frame->size < 4)
 		goto fail;
 
+	memset(&hdr, 0, sizeof(hdr));
 	if (!l2cap_frame_get_u8(l2cap_frame, &hdr.address) ||
 			!l2cap_frame_get_u8(l2cap_frame, &hdr.control) ||
 			!l2cap_frame_get_u8(l2cap_frame, &length))
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/3 client: Fix uninitiailzed scalar variable

In reply to Tedd Ho-Jeong An

From: Tedd Ho-Jeong An <[email protected]>

This patch fixes the uninitiailzed varialble(CWE-457) reported by the Coverity scan.

---
 client/gatt.c | 3 +++
 1 file changed, 3 insertions(+)
client/gatt.c +3 -0
index ce13b3341..9c991c2ac 100644
@@ -175,6 +175,7 @@ static void print_service_proxy(GDBusProxy *proxy, const char *description)
 
 	dbus_message_iter_get_basic(&iter, &primary);
 
+	memset(&service, 0, sizeof(service));
 	service.path = (char *) g_dbus_proxy_get_path(proxy);
 	service.uuid = (char *) uuid;
 	service.primary = primary;
@@ -257,6 +258,7 @@ static void print_characteristic(GDBusProxy *proxy, const char *description)
 
 	dbus_message_iter_get_basic(&iter, &uuid);
 
+	memset(&chrc, 0, sizeof(chrc));
 	chrc.path = (char *) g_dbus_proxy_get_path(proxy);
 	chrc.uuid = (char *) uuid;
 
@@ -350,6 +352,7 @@ static void print_descriptor(GDBusProxy *proxy, const char *description)
 
 	dbus_message_iter_get_basic(&iter, &uuid);
 
+	memset(&desc, 0, sizeof(desc));
 	desc.path = (char *) g_dbus_proxy_get_path(proxy);
 	desc.uuid = (char *) uuid;
 
Signature · 1 line
2.25.1
#3 lore raw
In reply to Tedd Ho-Jeong An

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=579489

---Test result---

Test Summary:

CheckPatch                    PASS      3.70 seconds
GitLint                       PASS      2.48 seconds
Prep - Setup ELL              PASS      44.05 seconds
Build - Prep                  PASS      0.48 seconds
Build - Configure             PASS      8.20 seconds
Build - Make                  PASS      185.97 seconds
Make Check                    PASS      9.37 seconds
Make Distcheck                PASS      228.10 seconds
Build w/ext ELL - Configure   PASS      8.27 seconds
Build w/ext ELL - Make        PASS      175.09 seconds

---
Regards,
Linux Bluetooth