aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-05-25 18:12:41 +0200
committerFelix Fietkau <nbd@nbd.name>2021-05-25 19:01:16 +0200
commit5f1338e9839bebe497672c4ca6c0bca4adccf3fa (patch)
treefcda37ddb30cc2e08596de6972dd1a82b63ecae0 /target
parentefee640716ed4f3273ea3e24e0b0b0d9b792433a (diff)
downloadupstream-5f1338e9839bebe497672c4ca6c0bca4adccf3fa.tar.gz
upstream-5f1338e9839bebe497672c4ca6c0bca4adccf3fa.tar.bz2
upstream-5f1338e9839bebe497672c4ca6c0bca4adccf3fa.zip
kernel: fix a perf build error
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/pending-5.10/110-perf-jevents-fix-getting-maximum-number-of-fds.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/target/linux/generic/pending-5.10/110-perf-jevents-fix-getting-maximum-number-of-fds.patch b/target/linux/generic/pending-5.10/110-perf-jevents-fix-getting-maximum-number-of-fds.patch
new file mode 100644
index 0000000000..ab6b250953
--- /dev/null
+++ b/target/linux/generic/pending-5.10/110-perf-jevents-fix-getting-maximum-number-of-fds.patch
@@ -0,0 +1,24 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Tue, 25 May 2021 18:00:34 +0200
+Subject: [PATCH] perf jevents: fix getting maximum number of fds
+
+On some hosts, rlim.rlim_max can be returned as RLIM_INFINITY.
+By casting it to int, it is interpreted as -1, which will cause get_maxfds
+to return 0, causing "Invalid argument" errors in nftw() calls.
+Fix this by casting the second argument of min() to rlim_t instead.
+
+Fixes: 80eeb67fe577 ("perf jevents: Program to convert JSON file")
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/tools/perf/pmu-events/jevents.c
++++ b/tools/perf/pmu-events/jevents.c
+@@ -897,7 +897,7 @@ static int get_maxfds(void)
+ struct rlimit rlim;
+
+ if (getrlimit(RLIMIT_NOFILE, &rlim) == 0)
+- return min((int)rlim.rlim_max / 2, 512);
++ return min(rlim.rlim_max / 2, (rlim_t)512);
+
+ return 512;
+ }