* [PATCH] staprun: fix build against upcoming `gcc-14` (`-Werror=calloc-transposed-args`)
@ 2023-12-21 10:00 Sergei Trofimovich
2023-12-21 14:58 ` Frank Ch. Eigler
0 siblings, 1 reply; 2+ messages in thread
From: Sergei Trofimovich @ 2023-12-21 10:00 UTC (permalink / raw)
To: systemtap; +Cc: Sergei Trofimovich
`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);
| ^~~~
---
staprun/staprun.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.42.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] staprun: fix build against upcoming `gcc-14` (`-Werror=calloc-transposed-args`)
2023-12-21 10:00 [PATCH] staprun: fix build against upcoming `gcc-14` (`-Werror=calloc-transposed-args`) Sergei Trofimovich
@ 2023-12-21 14:58 ` Frank Ch. Eigler
0 siblings, 0 replies; 2+ messages in thread
From: Frank Ch. Eigler @ 2023-12-21 14:58 UTC (permalink / raw)
To: Sergei Trofimovich; +Cc: systemtap
Sergei Trofimovich <slyich@gmail.com> writes:
> `gcc-14` added a new `-Wcalloc-transposed-args` warning recently. It
> detected minor infelicity in `calloc()` API usage in `systemtap`:
Thanks, merged.
- FChE
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-21 14:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-21 10:00 [PATCH] staprun: fix build against upcoming `gcc-14` (`-Werror=calloc-transposed-args`) Sergei Trofimovich
2023-12-21 14:58 ` Frank Ch. Eigler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).