[PATCH BlueZ v2 3/3] mesh: Fix 'buf’ may be used uninitialized warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



../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





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux