diff options
author | Khem Raj <raj.khem@gmail.com> | 2023-01-23 13:18:34 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-05-26 07:53:13 +0100 |
commit | 5a891d8c3d7e9d8d36bab680ef9fe3ac40fdb8b8 (patch) | |
tree | 44dd97ad9812b6ffcf3980e019a74b9b70bfc44c | |
parent | abe97fa74b10c2c71d79bc3573d4edb509b111f5 (diff) | |
download | openembedded-core-5a891d8c3d7e9d8d36bab680ef9fe3ac40fdb8b8.tar.gz |
perf: Fix build with gcc-13
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta/recipes-kernel/linux/files/0001-perf-cpumap-Make-counter-as-unsigned-ints.patch | 69 | ||||
-rw-r--r-- | meta/recipes-kernel/linux/linux-yocto_6.1.bb | 1 |
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 @@ +From d14450f9e0f05ea7177c5404a7a9289352caab77 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 23 Jan 2023 13:04:10 -0800 +Subject: [PATCH] perf cpumap: Make counter as unsigned ints + +These are loop counters which is inherently unsigned. Therefore make +them unsigned. Moreover it also fixes alloc-size-larger-than +error with gcc-13, where malloc can be called with (-1) due to tmp_len +being an int type. + +Fixes +| cpumap.c:366:20: error: argument 1 range [18446744065119617024, 18446744073709551612] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=] +| 366 | tmp_cpus = malloc(tmp_len * sizeof(struct perf_cpu)); +| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Cc: Peter Zijlstra <peterz@infradead.org> +Cc: Ingo Molnar <mingo@redhat.com> +Cc: Arnaldo Carvalho de Melo <acme@kernel.org> +Cc: Mark Rutland <mark.rutland@arm.com> +Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> +Cc: Jiri Olsa <jolsa@kernel.org> +Cc: Namhyung Kim <namhyung@kernel.org> + +Upstream-Status: Submitted [https://lore.kernel.org/linux-perf-users/20230123211310.127532-1-raj.khem@gmail.com/T/#u] +--- + tools/lib/perf/cpumap.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/tools/lib/perf/cpumap.c b/tools/lib/perf/cpumap.c +index 6cd0be7c1bb4..d960880dd903 100644 +--- a/tools/lib/perf/cpumap.c ++++ b/tools/lib/perf/cpumap.c +@@ -351,8 +351,8 @@ struct perf_cpu_map *perf_cpu_map__merge(struct perf_cpu_map *orig, + struct perf_cpu_map *other) + { + struct perf_cpu *tmp_cpus; +- int tmp_len; +- int i, j, k; ++ unsigned int tmp_len; ++ unsigned int i, j, k; + struct perf_cpu_map *merged; + + if (perf_cpu_map__is_subset(orig, other)) +@@ -369,7 +369,7 @@ struct perf_cpu_map *perf_cpu_map__merge(struct perf_cpu_map *orig, + + /* Standard merge algorithm from wikipedia */ + i = j = k = 0; +- while (i < orig->nr && j < other->nr) { ++ while (i < (unsigned int)orig->nr && j < (unsigned int)other->nr) { + if (orig->map[i].cpu <= other->map[j].cpu) { + if (orig->map[i].cpu == other->map[j].cpu) + j++; +@@ -378,10 +378,10 @@ struct perf_cpu_map *perf_cpu_map__merge(struct perf_cpu_map *orig, + tmp_cpus[k++] = other->map[j++]; + } + +- while (i < orig->nr) ++ while (i < (unsigned int)orig->nr) + tmp_cpus[k++] = orig->map[i++]; + +- while (j < other->nr) ++ while (j < (unsigned int)other->nr) + tmp_cpus[k++] = other->map[j++]; + assert(k <= tmp_len); + +-- +2.39.1 + 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" SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH};protocol=https \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-6.1;destsuffix=${KMETA};protocol=https" +SRC_URI += "file://0001-perf-cpumap-Make-counter-as-unsigned-ints.patch" LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" LINUX_VERSION ?= "6.1.25" |