shared: Fix the incorrect type with bit shift
authorTedd Ho-Jeong An <tedd.an@intel.com>
Thu, 17 Feb 2022 06:31:45 +0000 (22:31 -0800)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:53 +0000 (14:55 +0530)
This patch fixes the following runtime error:

$ sudo ./monitor/btmon -w test.btsnoop
  Bluetooth monitor ver 5.63
  src/shared/btsnoop.c:339:18: runtime error: left shift of 65535 by 16 places cannot be represented in type 'int'

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/shared/btsnoop.c

index e15f348..086c17a 100755 (executable)
@@ -528,7 +528,7 @@ bool btsnoop_write_hci(struct btsnoop *btsnoop, struct timeval *tv,
                break;
 
        case BTSNOOP_FORMAT_MONITOR:
-               flags = (index << 16) | opcode;
+               flags = ((uint32_t)index << 16) | opcode;
                break;
 
        default: