Skip to contentSkip to conversation

selftests/bpf: Fix undefined UINT_MAX in veristat.c

PATCH Applied Tony Ambardar 2 participants 2 messages Jan 16, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/bpf: Fix undefined UINT_MAX in veristat.c

Include <limits.h> in 'veristat.c' to provide a UINT_MAX definition and avoid multiple compile errors against mips64el/musl-libc:

veristat.c: In function 'max_verifier_log_size':
veristat.c:1135:36: error: 'UINT_MAX' undeclared (first use in this function)
1135 | const int SMALL_LOG_SIZE = UINT_MAX >> 8;
| ^~~~~~~~
veristat.c:24:1: note: 'UINT_MAX' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?

   23 | #include <math.h>
  +++ |+#include <limits.h>
   24 |
CC Mykyta Yatsenko <[email protected]>
Fixes 1f7c33630724 ("selftests/bpf: Increase verifier log limit in veristat")
---
 tools/testing/selftests/bpf/veristat.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/veristat.c +1 -0
index 8dcf5ee000ca..c72111dfb35d 100644
@@ -21,6 +21,7 @@
 #include <gelf.h>
 #include <float.h>
 #include <math.h>
+#include <limits.h>
 
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
Signature · 1 line
2.34.1
#1 lore raw
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Quoted 8 lines · On Wed, 15 Jan 2025 23:50:36 -0800 you wrote:

Include <limits.h> in 'veristat.c' to provide a UINT_MAX definition and avoid multiple compile errors against mips64el/musl-libc:

veristat.c: In function 'max_verifier_log_size':
veristat.c:1135:36: error: 'UINT_MAX' undeclared (first use in this function)
1135 | const int SMALL_LOG_SIZE = UINT_MAX >> 8;
| ^~~~~~~~
veristat.c:24:1: note: 'UINT_MAX' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?

Quoted 5 lines
   23 | #include <math.h>
  +++ |+#include <limits.h>
   24 |

[...]

Here is the summary with links:
- [bpf,v1] selftests/bpf: Fix undefined UINT_MAX in veristat.c

    https://git.kernel.org/bpf/bpf-next/c/a8d1c48d0720

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html