From c5474085db207d2c1664a78ba9a95fbda9cb3a8e Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Mon, 29 Jan 2024 12:17:18 +0100 Subject: [PATCH] Bluetooth: Controller: Fix coverity issue 340845 Fix coverity issue 340845, Uninitialized pointer read. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ull_df.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_df.c b/subsys/bluetooth/controller/ll_sw/ull_df.c index 6d29d10fcd9..06fd25fb653 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_df.c +++ b/subsys/bluetooth/controller/ll_sw/ull_df.c @@ -865,14 +865,17 @@ static uint8_t cte_info_set(struct ll_adv_set *adv, struct lll_df_adv_cfg *df_cf /* Note: ULL_ADV_PDU_EXTRA_DATA_ALLOC_ALWAYS is just information that extra_data * is required in case of this ull_adv_sync_pdu_alloc. */ + extra_data = NULL; err = ull_adv_sync_pdu_alloc(adv, ULL_ADV_PDU_EXTRA_DATA_ALLOC_ALWAYS, &pdu_prev, &pdu, NULL, &extra_data, ter_idx); if (err != BT_HCI_ERR_SUCCESS) { return err; } - ull_adv_sync_extra_data_set_clear(NULL, extra_data, ULL_ADV_PDU_HDR_FIELD_CTE_INFO, 0, - df_cfg); + if (extra_data) { + ull_adv_sync_extra_data_set_clear(NULL, extra_data, ULL_ADV_PDU_HDR_FIELD_CTE_INFO, + 0, df_cfg); + } #if (CONFIG_BT_CTLR_DF_PER_ADV_CTE_NUM_MAX > 1) if (df_cfg->cte_count > 1) {