From 71c75928c1d199e1e3e3c0101f6f32294abc8e71 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Wed, 7 Jun 2023 16:40:40 +0200 Subject: [PATCH] Bluetooth: Mesh: Avoid undefined behavior in bit shift in blob_cli.c block_size_log can be 0x20 which will shift 1 by 32 bits which will cause undefined behavior. Adding ULL to 1 is an option but this will add little bit more code when debug option is enabled. So simply print the logarithmic value. Coverity-ID: 316387 Fixes #58951 Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/blob_cli.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/blob_cli.c b/subsys/bluetooth/mesh/blob_cli.c index 45ffcf5d2dafa7..e2b0fc68a70c48 100644 --- a/subsys/bluetooth/mesh/blob_cli.c +++ b/subsys/bluetooth/mesh/blob_cli.c @@ -1550,9 +1550,9 @@ int bt_mesh_blob_cli_send(struct bt_mesh_blob_cli *cli, return -ENODEV; } - LOG_DBG("\n\tblock size: %u\n\tchunk size: %u\n" + LOG_DBG("\n\tblock size log: %u\n\tchunk size: %u\n" "\tblob size: %u\n\tmode: %x", - (1 << cli->xfer->block_size_log), cli->xfer->chunk_size, + cli->xfer->block_size_log, cli->xfer->chunk_size, cli->xfer->size, cli->xfer->mode); return xfer_start(cli);