Fix undefined behaviour. (#19116)
vkalintiris committed
Dec 2, 2024 at 20:40 UTC
bf8aa933371bab6febc1d76d8a84cabb97ecddcb
1 file changed
+5
-9
src/libnetdata/ebpf/ebpf.c
+5
-9
@@ -1652,15 +1652,11 @@ int ebpf_disable_tracing_values(char *subsys, char *eventname)
1652
*/
1653
static uint32_t ebpf_select_pc_prefix()
1654
{
1655
- long counter = 1;
1656
- uint32_t i;
1657
- for (i = 0; i < 128; i++) {
1658
- counter <<= 1;
1659
- if (counter < 0)
1660
- break;
1661
- }
1662
-
1663
- return counter;
1655
+#if SIZE_OF_VOID_P == 4
1656
+ return 32;
1657
+#else
1658
+ return 64;
1659
+#endif
1660
}
1661
1662
/**