Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/dump1090: fix build with GCC 14
@ 2024-06-27  8:02 Peter Korsgaard
  2024-07-12 14:00 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Korsgaard @ 2024-06-27  8:02 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 .../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

diff --git a/package/dump1090/0001-swap-size-arguments-to-calloc.patch b/package/dump1090/0001-swap-size-arguments-to-calloc.patch
new file mode 100644
index 0000000000..1c2d502793
--- /dev/null
+++ b/package/dump1090/0001-swap-size-arguments-to-calloc.patch
@@ -0,0 +1,43 @@
+From be8f5b7ab1223076ba0086f14aeeb53ace2d4b5c Mon Sep 17 00:00:00 2001
+From: Jeff Lawson <jeff.lawson@flightaware.com>
+Date: Tue, 18 Jun 2024 15:58:24 +0000
+Subject: [PATCH] swap size arguments to calloc
+
+fixes #241
+
+Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
+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
+
-- 
2.39.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH] package/dump1090: fix build with GCC 14
  2024-06-27  8:02 [Buildroot] [PATCH] package/dump1090: fix build with GCC 14 Peter Korsgaard
@ 2024-07-12 14:00 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-12 14:00 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: buildroot

On Thu, 27 Jun 2024 10:02:04 +0200
Peter Korsgaard <peter@korsgaard.com> 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))) {
> 
> Add a patch from an upstream pull request to fix that.
> 
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> ---
>  .../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
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-12 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27  8:02 [Buildroot] [PATCH] package/dump1090: fix build with GCC 14 Peter Korsgaard
2024-07-12 14:00 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox