DPDK patches and discussions
 help / color / mirror / Atom feed
From: Usman Tanveer <usman.tanveer@emumba.com>
To: dev@dpdk.org
Cc: ciara.power@intel.com, ndabilpuram@marvell.com,
	kirankumark@marvell.com, skori@marvell.com,
	skoteshwar@marvell.com, Usman Tanveer <usman.tanveer@emumba.com>
Subject: [PATCH] net/cnxk: fix segmentation fault in telemetry
Date: Thu, 30 Jun 2022 14:24:22 +0500	[thread overview]
Message-ID: <20220630092422.114332-1-usman.tanveer@emumba.com> (raw)

It gives segmentation fault when no parameter is passed for
command '/cnxk/ipsec/info' in usertools/telemetry app as NULL
is being passed as parameter to strtoul(). Now this function
returns -1 before strtoul() if no parameter is passed.

Signed-off-by: Usman Tanveer <usman.tanveer@emumba.com>
---
 drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c
index dfad5af8fe..088798d70a 100644
--- a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c
+++ b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c
@@ -229,6 +229,9 @@ ethdev_sec_tel_handle_info(const char *cmd __rte_unused, const char *params,
 	uint32_t i;
 	int ret;
 
+	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+		return -1;
+
 	port_id = strtoul(params, &end_p, 0);
 	if (errno != 0)
 		return -EINVAL;
-- 
2.25.1


             reply	other threads:[~2022-06-30  9:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30  9:24 Usman Tanveer [this message]
2022-06-30  9:34 ` David Marchand

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=20220630092422.114332-1-usman.tanveer@emumba.com \
    --to=usman.tanveer@emumba.com \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.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;
as well as URLs for NNTP newsgroup(s).