From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Radu Nicolau <radu.nicolau@intel.com>,
Akhil Goyal <gakhil@marvell.com>
Subject: [PATCH 08/37] examples/ipsec-secgw: remove unreachable config error path
Date: Sun, 29 Nov 2026 16:26:53 -0800 [thread overview]
Message-ID: <20261130002752.2342213-9-stephen@networkplumber.org> (raw)
In-Reply-To: <20261130002752.2342213-1-stephen@networkplumber.org>
Clang reports eight unreachable statements in parse_cfg_file().
Each error check calls rte_panic() and then does "goto error_exit",
but rte_panic() does not return, so none of the gotos can be taken
and the error_exit cleanup block is never entered.
Remove the dead gotos and the orphaned label. Error handling is
unchanged: rte_panic() still aborts on a bad config file.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/ipsec-secgw/parser.c | 40 +++++++----------------------------
1 file changed, 8 insertions(+), 32 deletions(-)
diff --git a/examples/ipsec-secgw/parser.c b/examples/ipsec-secgw/parser.c
index 29c4d3cb3d..fda6384e5a 100644
--- a/examples/ipsec-secgw/parser.c
+++ b/examples/ipsec-secgw/parser.c
@@ -434,15 +434,11 @@ parse_cfg_file(const char *cfg_filename)
uint32_t line_num = 0;
struct parse_status status = {0};
- if (f == NULL) {
+ if (f == NULL)
rte_panic("Error: invalid file descriptor %s\n", cfg_filename);
- goto error_exit;
- }
- if (cl == NULL) {
+ if (cl == NULL)
rte_panic("Error: cannot create cmdline instance\n");
- goto error_exit;
- }
cfg_sp_add_rule.data = &status;
cfg_sa_add_rule.data = &status;
@@ -460,12 +456,10 @@ parse_cfg_file(const char *cfg_filename)
line_num++;
- if (strlen(oneline) > 1022) {
+ if (strlen(oneline) > 1022)
rte_panic("%s:%u: error: "
"the line contains more characters the parser can handle\n",
cfg_filename, line_num);
- goto error_exit;
- }
/* process comment char '#' */
if (oneline[0] == '#')
@@ -478,47 +472,37 @@ parse_cfg_file(const char *cfg_filename)
/* process line concatenator '\' */
pos = strchr(oneline, 92);
if (pos != NULL) {
- if (pos != oneline+strlen(oneline) - 2) {
+ if (pos != oneline+strlen(oneline) - 2)
rte_panic("%s:%u: error: "
"no character should exist after '\\'\n",
cfg_filename, line_num);
- goto error_exit;
- }
*pos = '\0';
- if (strlen(oneline) + strlen(str) > 1022) {
+ if (strlen(oneline) + strlen(str) > 1022)
rte_panic("%s:%u: error: "
"the concatenated line contains more characters the parser can handle\n",
cfg_filename, line_num);
- goto error_exit;
- }
strcpy(str + strlen(str), oneline);
continue;
}
/* copy the line to str and process */
- if (strlen(oneline) + strlen(str) > 1022) {
+ if (strlen(oneline) + strlen(str) > 1022)
rte_panic("%s:%u: error: "
"the line contains more characters the parser can handle\n",
cfg_filename, line_num);
- goto error_exit;
- }
strcpy(str + strlen(str), oneline);
str[strlen(str)] = '\n';
- if (cmdline_parse(cl, str) < 0) {
+ if (cmdline_parse(cl, str) < 0)
rte_panic("%s:%u: error: parsing \"%s\" failed\n",
cfg_filename, line_num, str);
- goto error_exit;
- }
- if (status.status < 0) {
+ if (status.status < 0)
rte_panic("%s:%u: error: %s", cfg_filename,
line_num, status.parse_msg);
- goto error_exit;
- }
memset(str, 0, 1024);
} while (1);
@@ -531,12 +515,4 @@ parse_cfg_file(const char *cfg_filename)
sp6_sort_arr();
return 0;
-
-error_exit:
- if (cl)
- cmdline_stdin_exit(cl);
- if (f)
- fclose(f);
-
- return -1;
}
--
2.53.0
next prev parent reply other threads:[~2026-11-30 0:29 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 0:26 [PATCH 00/37] enable unreachable code detection Stephen Hemminger
2026-11-30 0:26 ` [PATCH 01/37] net/mlx4: fix unreachable code warnings Stephen Hemminger
2026-11-30 0:26 ` [PATCH 02/37] net/mlx5: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 03/37] eventdev: fix vector adapter instance allocation Stephen Hemminger
2026-11-30 0:26 ` [PATCH 04/37] eal: silence unreachable code in version string Stephen Hemminger
2026-11-30 9:13 ` Bruce Richardson
2026-11-30 0:26 ` [PATCH 05/37] net/dpaa2: remove debug abort in flow destroy Stephen Hemminger
2026-11-30 0:26 ` [PATCH 06/37] app/testpmd: fix unreachable VF traffic error message Stephen Hemminger
2026-11-30 0:26 ` [PATCH 07/37] examples/eventdev_pipeline: remove dead continue Stephen Hemminger
2026-11-30 0:26 ` Stephen Hemminger [this message]
2026-11-30 9:52 ` [PATCH 08/37] examples/ipsec-secgw: remove unreachable config error path Radu Nicolau
2026-11-30 0:26 ` [PATCH 09/37] examples/skeleton: handle SIGINT and SIGTERM Stephen Hemminger
2026-11-30 0:26 ` [PATCH 10/37] examples/rxtx_callbacks: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 11/37] examples/service_cores: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 12/37] examples/timer: " Stephen Hemminger
2026-11-30 0:26 ` [PATCH 13/37] examples/multi_process: handle SIGINT and SIGTERM in client Stephen Hemminger
2026-11-30 0:26 ` [PATCH 14/37] examples/server_node_efd: handle SIGINT and SIGTERM in node Stephen Hemminger
2026-11-30 0:27 ` [PATCH 15/37] examples/pipeline: handle SIGINT and SIGTERM Stephen Hemminger
2026-11-30 0:27 ` [PATCH 16/37] ethdev: fix unreachable warnings from switch declarations Stephen Hemminger
2026-11-30 0:27 ` [PATCH 17/37] config: add per-directory option for -Wunreachable-code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 18/37] bus/dpaa: exempt this driver from unreachable code detection Stephen Hemminger
2026-11-30 0:27 ` [PATCH 19/37] net/qede: disable unreachable code checks Stephen Hemminger
2026-11-30 0:27 ` [PATCH 20/37] net/txgbe: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 21/37] net/ixgbe: disable unreachable code check Stephen Hemminger
2026-11-30 9:14 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 22/37] net/ngbe: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 23/37] net/octeontx: replace unreachable code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 24/37] common/sfc_efx: disable unreachable code check for base code Stephen Hemminger
2026-11-30 0:27 ` [PATCH 25/37] net/dpaa2: check port state before changing TM hierarchy Stephen Hemminger
2026-11-30 0:27 ` [PATCH 26/37] net/e1000: disable unreachable code check for base code Stephen Hemminger
2026-11-30 9:14 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 27/37] net/ice: " Stephen Hemminger
2026-11-30 9:16 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 28/37] raw/ifpga: " Stephen Hemminger
2026-11-30 9:43 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 29/37] net/bnxt: disable unreachable code check Stephen Hemminger
2026-11-30 0:27 ` [PATCH 30/37] net/ntnic: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 31/37] lib: mark never returning thread functions Stephen Hemminger
2026-11-30 9:44 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 32/37] lib: remove unreachable statements Stephen Hemminger
2026-11-30 0:27 ` [PATCH 33/37] app: " Stephen Hemminger
2026-11-30 0:27 ` [PATCH 34/37] examples: " Stephen Hemminger
2026-11-30 9:45 ` Bruce Richardson
2026-11-30 0:27 ` [PATCH 35/37] drivers: " Stephen Hemminger
2026-11-30 10:59 ` Dariusz Sosnowski
2026-11-30 0:27 ` [PATCH 36/37] efd: mark configuration dependent vector selection Stephen Hemminger
2026-11-30 0:27 ` [PATCH 37/37] config: enable unreachable code detection Stephen Hemminger
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=20261130002752.2342213-9-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=radu.nicolau@intel.com \
/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