* [PATCH] examples/qos_sched: fix build with LTO
@ 2026-11-10 2:04 Stephen Hemminger
2026-11-10 9:05 ` Bruce Richardson
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2026-11-10 2:04 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, stable, Cristian Dumitrescu,
Michal Jastrzebski
rte_cfgfile_section_num_entries() returns -1 on error, which is used
unchecked as a VLA size. With LTO gcc inlines the library call, sees
the -1 path and fails with -Wvla-larger-than.
Return error if the entry count is negative.
Fixes: db935d0171dd ("examples/qos_sched: use librte_cfgfile")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/qos_sched/cfg_file.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c
index 3ca06c2ff9..e73d9f7cdd 100644
--- a/examples/qos_sched/cfg_file.c
+++ b/examples/qos_sched/cfg_file.c
@@ -438,6 +438,9 @@ cfg_load_subport(struct rte_cfgfile *cfg)
}
int n_entries = rte_cfgfile_section_num_entries(cfg, sec_name);
+ if (n_entries < 0)
+ return -1;
+
struct rte_cfgfile_entry entries[n_entries];
rte_cfgfile_section_entries(cfg, sec_name, entries, n_entries);
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] examples/qos_sched: fix build with LTO
2026-11-10 2:04 [PATCH] examples/qos_sched: fix build with LTO Stephen Hemminger
@ 2026-11-10 9:05 ` Bruce Richardson
2026-11-12 19:48 ` Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2026-11-10 9:05 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, stable, Cristian Dumitrescu, Michal Jastrzebski
On Mon, Nov 09, 2026 at 06:04:03PM -0800, Stephen Hemminger wrote:
> rte_cfgfile_section_num_entries() returns -1 on error, which is used
> unchecked as a VLA size. With LTO gcc inlines the library call, sees
> the -1 path and fails with -Wvla-larger-than.
>
> Return error if the entry count is negative.
>
> Fixes: db935d0171dd ("examples/qos_sched: use librte_cfgfile")
> Cc: stable@dpdk.org
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> examples/qos_sched/cfg_file.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c
> index 3ca06c2ff9..e73d9f7cdd 100644
> --- a/examples/qos_sched/cfg_file.c
> +++ b/examples/qos_sched/cfg_file.c
> @@ -438,6 +438,9 @@ cfg_load_subport(struct rte_cfgfile *cfg)
> }
>
> int n_entries = rte_cfgfile_section_num_entries(cfg, sec_name);
> + if (n_entries < 0)
> + return -1;
> +
> struct rte_cfgfile_entry entries[n_entries];
In practice I don't think that error case can occur, since an earlier check
verifies that the section exists. However, the check is harmless and not on
a fast-path.
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] examples/qos_sched: fix build with LTO
2026-11-10 9:05 ` Bruce Richardson
@ 2026-11-12 19:48 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2026-11-12 19:48 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, stable, Cristian Dumitrescu, Michal Jastrzebski,
Bruce Richardson
10/11/2026 10:05, Bruce Richardson:
> On Mon, Nov 09, 2026 at 06:04:03PM -0800, Stephen Hemminger wrote:
> > rte_cfgfile_section_num_entries() returns -1 on error, which is used
> > unchecked as a VLA size. With LTO gcc inlines the library call, sees
> > the -1 path and fails with -Wvla-larger-than.
> >
> > Return error if the entry count is negative.
> >
> > Fixes: db935d0171dd ("examples/qos_sched: use librte_cfgfile")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-12 19:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10 2:04 [PATCH] examples/qos_sched: fix build with LTO Stephen Hemminger
2026-11-10 9:05 ` Bruce Richardson
2026-11-12 19:48 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox