All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] main: Fix scanning alert no. 21
@ 2025-04-28 15:39 Luiz Augusto von Dentz
  2025-04-28 17:06 ` [BlueZ,v1] " bluez.test.bot
  2025-04-28 21:40 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2025-04-28 15:39 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Comparison of narrow type with wide type in loop condition
Comparison between of type uint16_t and of wider type size_t.

In a loop condition, comparison of a value of a narrow type with a value
of a wide type may result in unexpected behavior if the wider value is
sufficiently large (or small). This is because the narrower value may
overflow. This can lead to an infinite loop.
---
 src/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main.c b/src/main.c
index 6a682e9b921f..3c51a0092425 100644
--- a/src/main.c
+++ b/src/main.c
@@ -501,7 +501,7 @@ static void parse_mode_config(GKeyFile *config, const char *group,
 				const struct config_param *params,
 				size_t params_len)
 {
-	uint16_t i;
+	size_t i;
 
 	if (!config)
 		return;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-28 21:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-28 15:39 [PATCH BlueZ v1] main: Fix scanning alert no. 21 Luiz Augusto von Dentz
2025-04-28 17:06 ` [BlueZ,v1] " bluez.test.bot
2025-04-28 21:40 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.