* [PATCH] net/cnxk: fix segmentation fault in telemetry
@ 2022-06-30 9:24 Usman Tanveer
2022-06-30 9:34 ` David Marchand
0 siblings, 1 reply; 2+ messages in thread
From: Usman Tanveer @ 2022-06-30 9:24 UTC (permalink / raw)
To: dev
Cc: ciara.power, ndabilpuram, kirankumark, skori, skoteshwar, Usman Tanveer
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net/cnxk: fix segmentation fault in telemetry
2022-06-30 9:24 [PATCH] net/cnxk: fix segmentation fault in telemetry Usman Tanveer
@ 2022-06-30 9:34 ` David Marchand
0 siblings, 0 replies; 2+ messages in thread
From: David Marchand @ 2022-06-30 9:34 UTC (permalink / raw)
To: Usman Tanveer
Cc: dev, Ciara Power, Nithin Dabilpuram, Kiran Kumar Kokkilagadda,
Sunil Kumar Kori, Satha Rao
On Thu, Jun 30, 2022 at 11:24 AM Usman Tanveer <usman.tanveer@emumba.com> wrote:
>
> 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;
Duplicate of already merged: https://git.dpdk.org/dpdk/commit/?id=a31c9f970dfd
--
David Marchand
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-30 9:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30 9:24 [PATCH] net/cnxk: fix segmentation fault in telemetry Usman Tanveer
2022-06-30 9:34 ` David Marchand
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).