Skip to contentSkip to conversation

package/dump1090: fix build with GCC 14

PATCH Applied Peter Korsgaard 2 participants 2 messages Jun 27, 2024 – Jul 12, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/dump1090: fix build with GCC 14

Fixes http://autobuild.buildroot.net/results/1d5804974153f96e80f5200793ec8cd12c9fa18a/

GCC 14 complains if the arguments to calloc (nmemb, size) are swapped around, causing a build failure as dump1090 builds with -Werror:

net_io.c:107:34: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
107 | if (!(service = calloc(sizeof(*service), 1))) {

Add a patch from an upstream pull request to fix that.

---
 .../0001-swap-size-arguments-to-calloc.patch  | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/dump1090/0001-swap-size-arguments-to-calloc.patch
package/dump1090/0001-swap-size-arguments-to-calloc.patch new file +43 -0
new file mode 100644
index 0000000000..1c2d502793
@@ -0,0 +1,43 @@
+From be8f5b7ab1223076ba0086f14aeeb53ace2d4b5c Mon Sep 17 00:00:00 2001
+From: Jeff Lawson <[email protected]>
+Date: Tue, 18 Jun 2024 15:58:24 +0000
+Subject: [PATCH] swap size arguments to calloc
+
+fixes #241
+
+Signed-off-by: Peter Korsgaard <[email protected]>
+Upstream: https://github.com/flightaware/dump1090/pull/243
+---
+ adaptive.c | 2 +-
+ net_io.c   | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/adaptive.c b/adaptive.c
+index f16e16c..d656433 100644
+--- a/adaptive.c
++++ b/adaptive.c
+@@ -195,7 +195,7 @@ void adaptive_init()
+     adaptive_burst_window_remaining = adaptive_samples_per_window;
+     adaptive_burst_window_counter = 0;
+ 
+-    adaptive_range_radix = calloc(sizeof(unsigned), 65536);
++    adaptive_range_radix = calloc(65536, sizeof(unsigned));
+     adaptive_range_state = RANGE_RESCAN_UP;
+ 
+     // select and enforce gain limits
+diff --git a/net_io.c b/net_io.c
+index bf98028..8abd510 100644
+--- a/net_io.c
++++ b/net_io.c
+@@ -104,7 +104,7 @@ struct net_service *serviceInit(const char *descr, struct net_writer *writer, he
+ {
+     struct net_service *service;
+ 
+-    if (!(service = calloc(sizeof(*service), 1))) {
++    if (!(service = calloc(1, sizeof(*service)))) {
+         fprintf(stderr, "Out of memory allocating service %s\n", descr);
+         exit(1);
+     }
+-- 
+2.39.2
+
Signature · 6 lines
2.39.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 8 lines · On Thu, 27 Jun 2024 10:02:04 +0200 Peter Korsgaard <[email protected]> wrote:

Fixes http://autobuild.buildroot.net/results/1d5804974153f96e80f5200793ec8cd12c9fa18a/

GCC 14 complains if the arguments to calloc (nmemb, size) are swapped around, causing a build failure as dump1090 builds with -Werror:

net_io.c:107:34: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
107 | if (!(service = calloc(sizeof(*service), 1))) {

Quoted 7 lines

Add a patch from an upstream pull request to fix that.

---
 .../0001-swap-size-arguments-to-calloc.patch  | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/dump1090/0001-swap-size-arguments-to-calloc.patch

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot