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:
parent
395f250ef8
commit
617154f9d5
1 changed files with 6 additions and 2 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue