DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	stable@dpdk.org,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
	Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
Subject: [PATCH] examples/qos_sched: fix build with LTO
Date: Mon,  9 Nov 2026 18:04:03 -0800	[thread overview]
Message-ID: <20261110020403.419111-1-stephen@networkplumber.org> (raw)

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


             reply	other threads:[~2026-11-10  2:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  2:04 Stephen Hemminger [this message]
2026-11-10  9:05 ` [PATCH] examples/qos_sched: fix build with LTO Bruce Richardson
2026-11-12 19:48   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261110020403.419111-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=michalx.k.jastrzebski@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox