public inbox for netfilter-devel@vger.kernel.org
 help / color / mirror / Atom feed
* [nft PATCH] segtree: Fix for variable-sized object may not be initialized
@ 2026-03-19 13:32 Phil Sutter
  2026-03-20 11:16 ` Florian Westphal
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Sutter @ 2026-03-19 13:32 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel, Daniel Winship

Seen with gcc-11.5.0 on an aarch64 machine, build failed. Looking at the
code, r1len (or r1->len, actually) really seems variable. So use
memset() and fix build for that older compiler version at least.

Fixes: e8b17865833b8 ("segtree: Fix range aggregation on Big Endian")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/segtree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/segtree.c b/src/segtree.c
index bfea2f64ed812..a12820bcf1ece 100644
--- a/src/segtree.c
+++ b/src/segtree.c
@@ -426,8 +426,9 @@ void concat_range_aggregate(struct expr *set)
 			    string_type) {
 				unsigned int r1len = div_round_up(r1->len, BITS_PER_BYTE);
 				unsigned int str_len = prefix_len / BITS_PER_BYTE;
-				char data[r1len + 1] = {};
+				char data[r1len + 1];
 
+				memset(data, 0, r1len + 1);
 				mpz_export_data(data, r1->value, BYTEORDER_HOST_ENDIAN, r1len);
 				data[str_len] = '*';
 
-- 
2.51.0


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

* Re: [nft PATCH] segtree: Fix for variable-sized object may not be initialized
  2026-03-19 13:32 [nft PATCH] segtree: Fix for variable-sized object may not be initialized Phil Sutter
@ 2026-03-20 11:16 ` Florian Westphal
  2026-03-20 11:32   ` Phil Sutter
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2026-03-20 11:16 UTC (permalink / raw)
  To: Phil Sutter; +Cc: Pablo Neira Ayuso, netfilter-devel, Daniel Winship

Phil Sutter <phil@nwl.cc> wrote:
> Seen with gcc-11.5.0 on an aarch64 machine, build failed. Looking at the
> code, r1len (or r1->len, actually) really seems variable. So use
> memset() and fix build for that older compiler version at least.

Thanks for fixing this.

Acked-by: Florian Westphal <fw@strlen.de>

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

* Re: [nft PATCH] segtree: Fix for variable-sized object may not be initialized
  2026-03-20 11:16 ` Florian Westphal
@ 2026-03-20 11:32   ` Phil Sutter
  0 siblings, 0 replies; 3+ messages in thread
From: Phil Sutter @ 2026-03-20 11:32 UTC (permalink / raw)
  To: Florian Westphal; +Cc: Pablo Neira Ayuso, netfilter-devel, Daniel Winship

On Fri, Mar 20, 2026 at 12:16:17PM +0100, Florian Westphal wrote:
> Phil Sutter <phil@nwl.cc> wrote:
> > Seen with gcc-11.5.0 on an aarch64 machine, build failed. Looking at the
> > code, r1len (or r1->len, actually) really seems variable. So use
> > memset() and fix build for that older compiler version at least.
> 
> Thanks for fixing this.
> 
> Acked-by: Florian Westphal <fw@strlen.de>

Patch applied, thanks for your review!

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

end of thread, other threads:[~2026-03-20 11:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 13:32 [nft PATCH] segtree: Fix for variable-sized object may not be initialized Phil Sutter
2026-03-20 11:16 ` Florian Westphal
2026-03-20 11:32   ` Phil Sutter

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