Bluetooth: controller: fix comparision of unsigned int to 0
Fix the coverity issue CWE570, comparison of unsigned int to 0 in the definition of IS_SYNC_ISO_HANDLE There is a potentially the same issue for IS_ADV_ISO_HANDLE, fixed that as well Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
This commit is contained in:
parent
019ae15f05
commit
c5d844fe41
1 changed files with 14 additions and 0 deletions
|
@ -9,11 +9,18 @@
|
||||||
#define LL_BIS_ADV_HANDLE_BASE BT_CTLR_ADV_ISO_STREAM_HANDLE_BASE
|
#define LL_BIS_ADV_HANDLE_BASE BT_CTLR_ADV_ISO_STREAM_HANDLE_BASE
|
||||||
#define LL_BIS_ADV_IDX_FROM_HANDLE(conn_handle) \
|
#define LL_BIS_ADV_IDX_FROM_HANDLE(conn_handle) \
|
||||||
((conn_handle) - (LL_BIS_ADV_HANDLE_BASE))
|
((conn_handle) - (LL_BIS_ADV_HANDLE_BASE))
|
||||||
|
/* Conditional compile to prevent coverity issue CWE570, comparison of unsigned int to 0 */
|
||||||
|
#if (LL_BIS_ADV_HANDLE_BASE > 0)
|
||||||
#define IS_ADV_ISO_HANDLE(conn_handle) \
|
#define IS_ADV_ISO_HANDLE(conn_handle) \
|
||||||
(((conn_handle) >= (LL_BIS_ADV_HANDLE_BASE)) && \
|
(((conn_handle) >= (LL_BIS_ADV_HANDLE_BASE)) && \
|
||||||
((conn_handle) <= ((LL_BIS_ADV_HANDLE_BASE) + \
|
((conn_handle) <= ((LL_BIS_ADV_HANDLE_BASE) + \
|
||||||
(BT_CTLR_ADV_ISO_STREAM_MAX) - 1U)))
|
(BT_CTLR_ADV_ISO_STREAM_MAX) - 1U)))
|
||||||
#else
|
#else
|
||||||
|
#define IS_ADV_ISO_HANDLE(conn_handle) \
|
||||||
|
((conn_handle) <= ((LL_BIS_ADV_HANDLE_BASE) + \
|
||||||
|
(BT_CTLR_ADV_ISO_STREAM_MAX) - 1U))
|
||||||
|
#endif /* LL_BIS_ADV_HANDLE_BASE */
|
||||||
|
#else
|
||||||
#define LL_BIS_ADV_IDX_FROM_HANDLE(conn_handle) 0U
|
#define LL_BIS_ADV_IDX_FROM_HANDLE(conn_handle) 0U
|
||||||
#define IS_ADV_ISO_HANDLE(conn_handle) 0U
|
#define IS_ADV_ISO_HANDLE(conn_handle) 0U
|
||||||
#endif /* CONFIG_BT_CTLR_ADV_ISO */
|
#endif /* CONFIG_BT_CTLR_ADV_ISO */
|
||||||
|
@ -23,11 +30,18 @@
|
||||||
#define LL_BIS_SYNC_HANDLE_BASE BT_CTLR_SYNC_ISO_STREAM_HANDLE_BASE
|
#define LL_BIS_SYNC_HANDLE_BASE BT_CTLR_SYNC_ISO_STREAM_HANDLE_BASE
|
||||||
#define LL_BIS_SYNC_IDX_FROM_HANDLE(conn_handle) \
|
#define LL_BIS_SYNC_IDX_FROM_HANDLE(conn_handle) \
|
||||||
((conn_handle) - (LL_BIS_SYNC_HANDLE_BASE))
|
((conn_handle) - (LL_BIS_SYNC_HANDLE_BASE))
|
||||||
|
/* Conditional compile to prevent coverity issue CWE570, comparison of unsigned int to 0 */
|
||||||
|
#if (LL_BIS_SYNC_HANDLE_BASE > 0)
|
||||||
#define IS_SYNC_ISO_HANDLE(conn_handle) \
|
#define IS_SYNC_ISO_HANDLE(conn_handle) \
|
||||||
(((conn_handle) >= (LL_BIS_SYNC_HANDLE_BASE)) && \
|
(((conn_handle) >= (LL_BIS_SYNC_HANDLE_BASE)) && \
|
||||||
((conn_handle) <= ((LL_BIS_SYNC_HANDLE_BASE) + \
|
((conn_handle) <= ((LL_BIS_SYNC_HANDLE_BASE) + \
|
||||||
(BT_CTLR_SYNC_ISO_STREAM_MAX) - 1U)))
|
(BT_CTLR_SYNC_ISO_STREAM_MAX) - 1U)))
|
||||||
#else
|
#else
|
||||||
|
#define IS_SYNC_ISO_HANDLE(conn_handle) \
|
||||||
|
((conn_handle) <= ((LL_BIS_SYNC_HANDLE_BASE) + \
|
||||||
|
(BT_CTLR_SYNC_ISO_STREAM_MAX) - 1U))
|
||||||
|
#endif /* LL_BIS_SYNC_HANDLE_BASE */
|
||||||
|
#else
|
||||||
#define LL_BIS_SYNC_IDX_FROM_HANDLE(conn_handle) 0U
|
#define LL_BIS_SYNC_IDX_FROM_HANDLE(conn_handle) 0U
|
||||||
#define IS_SYNC_ISO_HANDLE(conn_handle) 0U
|
#define IS_SYNC_ISO_HANDLE(conn_handle) 0U
|
||||||
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue