blob: 22578fb3f6123bc40a487664823b1c4028972514 [file] [log] [blame]
Patrick Williams73bd93f2024-02-20 08:07:48 -06001From 52596f023652114642faba5726c99488529029ce Mon Sep 17 00:00:00 2001
2From: Sergei Trofimovich <slyich@gmail.com>
3Date: Thu, 21 Dec 2023 10:00:06 +0000
4Subject: [PATCH] staprun: fix build against upcoming `gcc-14`
5 (`-Werror=calloc-transposed-args`)
6
7`gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It
8detected minor infelicity in `calloc()` API usage in `systemtap`:
9
10 staprun.c: In function 'main':
11 staprun.c:550:50: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
12 550 | char ** new_argv = calloc(sizeof(char *),argc+2);
13 | ^~~~
14
15Upstream-Status: Backport [https://sourceware.org/git/?p=systemtap.git;a=commit;h=52596f023652114642faba5726c99488529029ce]
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 staprun/staprun.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/staprun/staprun.c b/staprun/staprun.c
22index 8437f3af6..d1b0b221b 100644
23--- a/staprun/staprun.c
24+++ b/staprun/staprun.c
25@@ -547,7 +547,7 @@ int main(int argc, char **argv)
26 us to extend argv[], with all the C fun that entails. */
27 #ifdef HAVE_OPENAT
28 if (relay_basedir_fd >= 0) {
29- char ** new_argv = calloc(sizeof(char *),argc+2);
30+ char ** new_argv = calloc(argc+2, sizeof(char *));
31 const int new_Foption_size = 10; /* -FNNNNN */
32 char * new_Foption = malloc(new_Foption_size);
33 int i;
34--
352.43.0
36