Skip to content

Commit 7e11b98

Browse files
alwa-nordicfabiobaltieri
authored andcommitted
Bluetooth: Host: Add "assert non-null" to bt_conn_ref
Clearly `conn` must be non-null since it's dereferenced without checks. Signed-off-by: Aleksander Wasaznik <[email protected]>
1 parent a8f12ab commit 7e11b98

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

subsys/bluetooth/host/conn.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,8 @@ struct bt_conn *bt_conn_ref(struct bt_conn *conn)
11201120
{
11211121
atomic_val_t old;
11221122

1123+
__ASSERT_NO_MSG(conn);
1124+
11231125
/* Reference counter must be checked to avoid incrementing ref from
11241126
* zero, then we should return NULL instead.
11251127
* Loop on clear-and-set in case someone has modified the reference

0 commit comments

Comments
 (0)