All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1 0/4] fix errors found by SVACE static analyzer #3
@ 2024-07-09 12:00 Roman Smirnov
  2024-07-09 12:00 ` [PATCH BlueZ v1 1/4] health: mcap: add checks for NULL mcap_notify_error() Roman Smirnov
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Roman Smirnov @ 2024-07-09 12:00 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roman Smirnov

Several bug fixes.

Roman Smirnov (4):
  health: mcap: add checks for NULL mcap_notify_error()
  shared: prevent dereferencing of NULL pointers
  settings: limit the string size in load_service()
  settings: limit the number of chars to be read in gatt_db_load()

 profiles/health/mcap.c |  9 +++++++
 src/settings.c         | 58 +++++++++++++++++++++++++++++++++++++++---
 src/shared/micp.c      |  4 +++
 src/shared/vcp.c       | 12 +++++++++
 4 files changed, 80 insertions(+), 3 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH BlueZ v2 1/4] health: mcap: add checks for NULL mcap_notify_error()
@ 2024-07-09 14:35 Roman Smirnov
  2024-07-09 18:03 ` fix errors found by SVACE static analyzer #3 bluez.test.bot
  0 siblings, 1 reply; 8+ messages in thread
From: Roman Smirnov @ 2024-07-09 14:35 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roman Smirnov

It is necessary to prevent dereferencing of NULL pointers.

Found with the SVACE static analysis tool.
---
 profiles/health/mcap.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/profiles/health/mcap.c b/profiles/health/mcap.c
index 7eceaa88a..2e4214a69 100644
--- a/profiles/health/mcap.c
+++ b/profiles/health/mcap.c
@@ -336,6 +336,9 @@ static void mcap_notify_error(struct mcap_mcl *mcl, GError *err)
 	case MCAP_MD_CREATE_MDL_REQ:
 		st = MDL_WAITING;
 		l = g_slist_find_custom(mcl->mdls, &st, cmp_mdl_state);
+		if (!l)
+			return;
+
 		mdl = l->data;
 		mcl->mdls = g_slist_remove(mcl->mdls, mdl);
 		mcap_mdl_unref(mdl);
@@ -345,6 +348,9 @@ static void mcap_notify_error(struct mcap_mcl *mcl, GError *err)
 	case MCAP_MD_ABORT_MDL_REQ:
 		st = MDL_WAITING;
 		l = g_slist_find_custom(mcl->mdls, &st, cmp_mdl_state);
+		if (!l)
+			return;
+
 		shutdown_mdl(l->data);
 		update_mcl_state(mcl);
 		con->cb.notify(err, con->user_data);
@@ -362,6 +368,9 @@ static void mcap_notify_error(struct mcap_mcl *mcl, GError *err)
 	case MCAP_MD_RECONNECT_MDL_REQ:
 		st = MDL_WAITING;
 		l = g_slist_find_custom(mcl->mdls, &st, cmp_mdl_state);
+		if (!l)
+			return;
+
 		shutdown_mdl(l->data);
 		update_mcl_state(mcl);
 		con->cb.op(NULL, err, con->user_data);
-- 
2.34.1


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

end of thread, other threads:[~2024-07-09 18:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-09 12:00 [PATCH BlueZ v1 0/4] fix errors found by SVACE static analyzer #3 Roman Smirnov
2024-07-09 12:00 ` [PATCH BlueZ v1 1/4] health: mcap: add checks for NULL mcap_notify_error() Roman Smirnov
2024-07-09 15:11   ` fix errors found by SVACE static analyzer #3 bluez.test.bot
2024-07-09 12:00 ` [PATCH BlueZ v1 2/4] shared: prevent dereferencing of NULL pointers Roman Smirnov
2024-07-09 12:00 ` [PATCH BlueZ v1 3/4] settings: limit the string size in load_service() Roman Smirnov
2024-07-09 14:02   ` Luiz Augusto von Dentz
2024-07-09 12:00 ` [PATCH BlueZ v1 4/4] settings: limit the number of chars to be read in gatt_db_load() Roman Smirnov
  -- strict thread matches above, loose matches on Subject: below --
2024-07-09 14:35 [PATCH BlueZ v2 1/4] health: mcap: add checks for NULL mcap_notify_error() Roman Smirnov
2024-07-09 18:03 ` fix errors found by SVACE static analyzer #3 bluez.test.bot

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.