systemtap/staprun-fix-build-against-upcoming-gcc14.patch
Tony Jones 54d088036b Accepting request 1164226 from home:jones_tony:branches:devel:tools
- Fix runtime issues with v6.8 kernel (bsc#1222249)
    New patch: get-shm_flag-defines-from-the-appropriate-include-file-for-linux-6.8-kernel.patch
    New patch: pr31373-deal-with-the-removal-of-strlcpy-from-linux-6.8.patch
- Fix gcc14 build errors (bsc#1221706)
    New patch: bpf-translate.cxx-fix-build-against-upcoming-gcc14.patch
    New patch: pr31288-build-with-gcc14-cont.patch
    New patch: pr31288-build-with-gcc14.patch
    New patch: staprun-fix-build-against-upcoming-gcc14.patch
    New patch: stapvirt.c-more-gcc-14-werror-calloc-transposed-args-compatibility.patch

OBS-URL: https://build.opensuse.org/request/show/1164226
OBS-URL: https://build.opensuse.org/package/show/devel:tools/systemtap?expand=0&rev=148
2024-04-02 19:00:34 +00:00

31 lines
1.4 KiB
Diff

From: Sergei Trofimovich <slyich@gmail.com>
Date: Thu Dec 21 10:00:06 2023 +0000
Subject: staprun: fix build against upcoming `gcc-14`
Git-commit: 52596f023652114642faba5726c99488529029ce
References: bsc#1221706
Signed-off-by: Tony Jones <tonyj@suse.de>
staprun: fix build against upcoming `gcc-14` (`-Werror=calloc-transposed-args`)
`gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It
detected minor infelicity in `calloc()` API usage in `systemtap`:
staprun.c: In function 'main':
staprun.c:550:50: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
550 | char ** new_argv = calloc(sizeof(char *),argc+2);
| ^~~~
diff --git a/staprun/staprun.c b/staprun/staprun.c
index 8437f3af6..d1b0b221b 100644
--- a/staprun/staprun.c
+++ b/staprun/staprun.c
@@ -547,7 +547,7 @@ int main(int argc, char **argv)
us to extend argv[], with all the C fun that entails. */
#ifdef HAVE_OPENAT
if (relay_basedir_fd >= 0) {
- char ** new_argv = calloc(sizeof(char *),argc+2);
+ char ** new_argv = calloc(argc+2, sizeof(char *));
const int new_Foption_size = 10; /* -FNNNNN */
char * new_Foption = malloc(new_Foption_size);
int i;