Skip to content

Commit 87820cb

Browse files
PavelVPVm-alperen-sener
authored andcommitted
[nrf fromtree] bluetooth: mesh: access: cast to uint8_t to avoid potential overflow
Explicitly cast `BT_MESH_TRANSMIT` output to avoid potential overflow. Fixes #84759 Fixes #84749 Fixes #84702 Coverity-CID: 487624 Coverity-CID: 487648 Coverity-CID: 487722 Signed-off-by: Pavel Vasilyev <[email protected]> (cherry picked from commit f82c0e8)
1 parent 3be9e1a commit 87820cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/zephyr/bluetooth/mesh/access.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ struct bt_mesh_model_op {
628628
* @return Mesh transmit value that can be used e.g. for the default
629629
* values of the configuration model data.
630630
*/
631-
#define BT_MESH_TRANSMIT(count, int_ms) ((count) | (((int_ms / 10) - 1) << 3))
631+
#define BT_MESH_TRANSMIT(count, int_ms) ((uint8_t)((count) | (((int_ms / 10) - 1) << 3)))
632632

633633
/**
634634
* @brief Decode transmit count from a transmit value.

0 commit comments

Comments
 (0)