summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-01-23 13:18:34 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-05-26 07:54:17 +0100
commitd52d7f524bea8f67580218ce5bfbc69036d6a9f5 (patch)
tree5ec4907284b32b078ba89a78d06b90e92b119d5b
parentac176badb21c907bf050e90c67bacb6bd5fe111f (diff)
downloadpoky-d52d7f524bea8f67580218ce5bfbc69036d6a9f5.tar.gz
perf: Fix build with gcc-13
(From OE-Core rev: 5a891d8c3d7e9d8d36bab680ef9fe3ac40fdb8b8) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-kernel/linux/files/0001-perf-cpumap-Make-counter-as-unsigned-ints.patch69
-rw-r--r--meta/recipes-kernel/linux/linux-yocto_6.1.bb1
2 files changed, 70 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/files/0001-perf-cpumap-Make-counter-as-unsigned-ints.patch b/meta/recipes-kernel/linux/files/0001-perf-cpumap-Make-counter-as-unsigned-ints.patch
new file mode 100644
index 0000000000..2bfc40fe04
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/0001-perf-cpumap-Make-counter-as-unsigned-ints.patch
@@ -0,0 +1,69 @@
1From d14450f9e0f05ea7177c5404a7a9289352caab77 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 23 Jan 2023 13:04:10 -0800
4Subject: [PATCH] perf cpumap: Make counter as unsigned ints
5
6These are loop counters which is inherently unsigned. Therefore make
7them unsigned. Moreover it also fixes alloc-size-larger-than
8error with gcc-13, where malloc can be called with (-1) due to tmp_len
9being an int type.
10
11Fixes
12| cpumap.c:366:20: error: argument 1 range [18446744065119617024, 18446744073709551612] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
13| 366 | tmp_cpus = malloc(tmp_len * sizeof(struct perf_cpu));
14| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17Cc: Peter Zijlstra <peterz@infradead.org>
18Cc: Ingo Molnar <mingo@redhat.com>
19Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
20Cc: Mark Rutland <mark.rutland@arm.com>
21Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
22Cc: Jiri Olsa <jolsa@kernel.org>
23Cc: Namhyung Kim <namhyung@kernel.org>
24
25Upstream-Status: Submitted [https://lore.kernel.org/linux-perf-users/20230123211310.127532-1-raj.khem@gmail.com/T/#u]
26---
27 tools/lib/perf/cpumap.c | 10 +++++-----
28 1 file changed, 5 insertions(+), 5 deletions(-)
29
30diff --git a/tools/lib/perf/cpumap.c b/tools/lib/perf/cpumap.c
31index 6cd0be7c1bb4..d960880dd903 100644
32--- a/tools/lib/perf/cpumap.c
33+++ b/tools/lib/perf/cpumap.c
34@@ -351,8 +351,8 @@ struct perf_cpu_map *perf_cpu_map__merge(struct perf_cpu_map *orig,
35 struct perf_cpu_map *other)
36 {
37 struct perf_cpu *tmp_cpus;
38- int tmp_len;
39- int i, j, k;
40+ unsigned int tmp_len;
41+ unsigned int i, j, k;
42 struct perf_cpu_map *merged;
43
44 if (perf_cpu_map__is_subset(orig, other))
45@@ -369,7 +369,7 @@ struct perf_cpu_map *perf_cpu_map__merge(struct perf_cpu_map *orig,
46
47 /* Standard merge algorithm from wikipedia */
48 i = j = k = 0;
49- while (i < orig->nr && j < other->nr) {
50+ while (i < (unsigned int)orig->nr && j < (unsigned int)other->nr) {
51 if (orig->map[i].cpu <= other->map[j].cpu) {
52 if (orig->map[i].cpu == other->map[j].cpu)
53 j++;
54@@ -378,10 +378,10 @@ struct perf_cpu_map *perf_cpu_map__merge(struct perf_cpu_map *orig,
55 tmp_cpus[k++] = other->map[j++];
56 }
57
58- while (i < orig->nr)
59+ while (i < (unsigned int)orig->nr)
60 tmp_cpus[k++] = orig->map[i++];
61
62- while (j < other->nr)
63+ while (j < (unsigned int)other->nr)
64 tmp_cpus[k++] = other->map[j++];
65 assert(k <= tmp_len);
66
67--
682.39.1
69
diff --git a/meta/recipes-kernel/linux/linux-yocto_6.1.bb b/meta/recipes-kernel/linux/linux-yocto_6.1.bb
index 36f7ed8791..bf172eb38e 100644
--- a/meta/recipes-kernel/linux/linux-yocto_6.1.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_6.1.bb
@@ -41,6 +41,7 @@ KBRANCH:class-devupstream = "v6.1/base"
41 41
42SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH};protocol=https \ 42SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH};protocol=https \
43 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-6.1;destsuffix=${KMETA};protocol=https" 43 git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-6.1;destsuffix=${KMETA};protocol=https"
44SRC_URI += "file://0001-perf-cpumap-Make-counter-as-unsigned-ints.patch"
44 45
45LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" 46LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
46LINUX_VERSION ?= "6.1.25" 47LINUX_VERSION ?= "6.1.25"