From bf8aa933371bab6febc1d76d8a84cabb97ecddcb Mon Sep 17 00:00:00 2001 From: vkalintiris Date: Mon, 2 Dec 2024 20:40:19 +0200 Subject: [PATCH] Fix undefined behaviour. (#19116) --- src/libnetdata/ebpf/ebpf.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/libnetdata/ebpf/ebpf.c b/src/libnetdata/ebpf/ebpf.c index 27042a794a1a64..1296de99ad8616 100644 --- a/src/libnetdata/ebpf/ebpf.c +++ b/src/libnetdata/ebpf/ebpf.c @@ -1652,15 +1652,11 @@ int ebpf_disable_tracing_values(char *subsys, char *eventname) */ static uint32_t ebpf_select_pc_prefix() { - long counter = 1; - uint32_t i; - for (i = 0; i < 128; i++) { - counter <<= 1; - if (counter < 0) - break; - } - - return counter; +#if SIZE_OF_VOID_P == 4 + return 32; +#else + return 64; +#endif } /**