linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ildar Kamaletdinov <i.kamaletdinov@omp.ru>
To: <linux-bluetooth@vger.kernel.org>
Cc: Ildar Kamaletdinov <i.kamaletdinov@omp.ru>
Subject: [PATCH BlueZ 4/4] device: Fix uninitialized value usage
Date: Sat, 7 May 2022 20:07:03 +0300	[thread overview]
Message-ID: <20220507170703.29902-5-i.kamaletdinov@omp.ru> (raw)
In-Reply-To: <20220507170703.29902-1-i.kamaletdinov@omp.ru>

Definitely `dbus_bool_t b;` must be initialized before comparing it
with current value.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
---
 src/device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/device.c b/src/device.c
index 6da5c380b..7114e1b3e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1568,6 +1568,8 @@ static void dev_property_set_wake_allowed(const GDBusPropertyTable *property,
 		return;
 	}
 
+	dbus_message_iter_get_basic(value, &b);
+
 	/* Emit busy or success depending on current value. */
 	if (b == device->pending_wake_allowed) {
 		if (device->wake_allowed == device->pending_wake_allowed)
@@ -1580,7 +1582,6 @@ static void dev_property_set_wake_allowed(const GDBusPropertyTable *property,
 		return;
 	}
 
-	dbus_message_iter_get_basic(value, &b);
 	device_set_wake_override(device, b);
 	device_set_wake_allowed(device, b, id);
 }
-- 
2.35.3


  parent reply	other threads:[~2022-05-07 17:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-07 17:06 [PATCH BlueZ 0/4] [v2] Fix few more bugs found by SVACE Ildar Kamaletdinov
2022-05-07 17:07 ` [PATCH BlueZ 1/4] tools: Fix memory leak in hciconfig Ildar Kamaletdinov
2022-05-07 20:00   ` Fix few more bugs found by SVACE bluez.test.bot
2022-05-07 17:07 ` [PATCH BlueZ 2/4] tools: Fix memory leaks in btgatt-server/client Ildar Kamaletdinov
2022-05-07 17:07 ` [PATCH BlueZ 3/4] tools: Fix handle leak in rfcomm Ildar Kamaletdinov
2022-05-07 17:07 ` Ildar Kamaletdinov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-05-07 17:35 [PATCH BlueZ 0/4] [v3] Fix few more bugs found by SVACE Ildar Kamaletdinov
2022-05-07 17:35 ` [PATCH BlueZ 4/4] device: Fix uninitialized value usage Ildar Kamaletdinov
2022-05-07 15:06 [PATCH BlueZ 0/4] Fix few more bugs found by SVACE Ildar Kamaletdinov
2022-05-07 15:06 ` [PATCH BlueZ 4/4] device: Fix uninitialized value usage Ildar Kamaletdinov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220507170703.29902-5-i.kamaletdinov@omp.ru \
    --to=i.kamaletdinov@omp.ru \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).