Bluetooth: Mesh: Avoid undefined behavior when block_size_log is 0x20

Use ULL suffix to promote the type of the shift operand to uint64_t to
avoid undefined behavior when block_size_log is 32.

Coverity-CID: 316387, GitHub issue #58528

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
Pavel Vasilyev 2023-06-01 16:27:40 +02:00 committed by Anas Nashif
commit 617154f9d5

View file

@ -1531,8 +1531,12 @@ int bt_mesh_blob_cli_send(struct bt_mesh_blob_cli *cli,
cli->xfer = xfer;
cli->inputs = inputs;
cli->io = io;
cli->block_count = DIV_ROUND_UP(cli->xfer->size,
(1U << cli->xfer->block_size_log));
if (cli->xfer->block_size_log == 0x20) {
cli->block_count = 1;
} else {
cli->block_count = DIV_ROUND_UP(cli->xfer->size, (1U << cli->xfer->block_size_log));
}
block_set(cli, 0);