From c9708ff951e5915a9b68d23e6ec960fc265bb2a6 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Wed, 3 Jul 2024 17:19:27 +0800 Subject: [PATCH] Bluetooth: A2DP: Check the pointer before using Check the pointer `sep` before using it. Fixes #74734. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/classic/a2dp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/host/classic/a2dp.c b/subsys/bluetooth/host/classic/a2dp.c index 9377675f7e2ab8..76300861c1beeb 100644 --- a/subsys/bluetooth/host/classic/a2dp.c +++ b/subsys/bluetooth/host/classic/a2dp.c @@ -195,11 +195,10 @@ static int a2dp_set_config_ind(struct bt_avdtp *session, struct bt_avdtp_sep *se int err; *errcode = 0; + + __ASSERT(sep, "Invalid sep"); + ep = CONTAINER_OF(sep, struct bt_a2dp_ep, sep); - if (ep == NULL) { - *errcode = BT_AVDTP_BAD_ACP_SEID; - return -1; - } /* parse the configuration */ codec_info_element_len = 4U;