Linux bluetooth development
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v2 3/3] mesh: Fix 'buf’ may be used uninitialized warning
Date: Thu,  7 Aug 2025 17:50:31 +0200	[thread overview]
Message-ID: <20250807155115.1037982-4-hadess@hadess.net> (raw)
In-Reply-To: <20250807155115.1037982-1-hadess@hadess.net>

../dist-unpack/bluez-5.83/tools/mesh/agent.c: In function ‘response_decimal’:
../dist-unpack/bluez-5.83/tools/mesh/agent.c:94:9: warning: ‘buf’ may be used uninitialized [-Wmaybe-uninitialized]
   94 |         bt_put_be32(atoi(input), buf);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../dist-unpack/bluez-5.83/tools/mesh/agent.c:20:
../dist-unpack/bluez-5.83/lib/bluetooth/bluetooth.h:342:20: note: by argument 2 of type ‘const void *’ to ‘bt_put_be32’ declared here
  342 | static inline void bt_put_be32(uint32_t val, const void *ptr)
      |                    ^~~~~~~~~~~
../dist-unpack/bluez-5.83/tools/mesh/agent.c:88:17: note: ‘buf’ declared here
   88 |         uint8_t buf[DECIMAL_OOB_LEN];
      |                 ^~~
---
 tools/mesh/agent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/mesh/agent.c b/tools/mesh/agent.c
index 7a62f345dac7..4a2c6a0d88dd 100644
--- a/tools/mesh/agent.c
+++ b/tools/mesh/agent.c
@@ -85,7 +85,7 @@ static void response_hexadecimal(const char *input, void *user_data)
 
 static void response_decimal(const char *input, void *user_data)
 {
-	uint8_t buf[DECIMAL_OOB_LEN];
+	uint8_t buf[DECIMAL_OOB_LEN] = {0};
 	uint16_t len = DECIMAL_OOB_LEN;
 
 	if (strlen(input) > pending_request.len)
-- 
2.50.0


  parent reply	other threads:[~2025-08-07 15:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 15:50 [PATCH BlueZ v2 0/3] Prepare for meson build system Bastien Nocera
2025-08-07 15:50 ` [PATCH BlueZ v2 1/3] build: Move library source to lib/bluetooth Bastien Nocera
2025-08-07 17:15   ` Prepare for meson build system bluez.test.bot
2025-08-08 14:42   ` [PATCH BlueZ v2 1/3] build: Move library source to lib/bluetooth Luiz Augusto von Dentz
2025-08-08 15:17     ` Bastien Nocera
2025-08-07 15:50 ` [PATCH BlueZ v2 2/3] client: Fix missing strdup/memset declarations Bastien Nocera
2025-08-07 15:50 ` Bastien Nocera [this message]
2025-08-11 12:50 ` [PATCH BlueZ v2 0/3] Prepare for meson build system patchwork-bot+bluetooth
2025-08-11 18:32 ` Pauli Virtanen
2025-08-11 18:37   ` Pauli Virtanen

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=20250807155115.1037982-4-hadess@hadess.net \
    --to=hadess@hadess.net \
    --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