From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3996AA0545; Thu, 30 Jun 2022 11:34:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D29E440223; Thu, 30 Jun 2022 11:34:58 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 49483400EF for ; Thu, 30 Jun 2022 11:34:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656581696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tWbJmDKGfXwIbnxu++7ZKYJwGqIGAkpXsGkwAtw+5Vk=; b=HhojpyqrqM7Z63qEOua/zSKtRhZnyTEFWqndz0FbH2WGFfDQy6NuvWSMSetvTsr3qRfpNf O2FleguGPCVXz12mhlp5RYtHcU9PRWDIV1A4SLhFArU8IIEf7lNvvf8SVHHpjSIYOdYltg BajS3N0OZID9M9LNvcFtiq3iYgIZ9VE= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-125-Jlf63sKjNj-WJnEtAlZ8Vw-1; Thu, 30 Jun 2022 05:34:54 -0400 X-MC-Unique: Jlf63sKjNj-WJnEtAlZ8Vw-1 Received: by mail-lf1-f71.google.com with SMTP id h18-20020a056512055200b004810d1b257aso6348486lfl.13 for ; Thu, 30 Jun 2022 02:34:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tWbJmDKGfXwIbnxu++7ZKYJwGqIGAkpXsGkwAtw+5Vk=; b=QKsAnADfiCp7MSuVXDFq3B1k7lA8DgDpb/+Ij8VlSDxtP4QSjDmOQkH8tMk1smk2v/ NDIOlIupIZ/6BMAKN73NCTJlXrRLtDtXcraAi3Tq1Q/liI2vf/oDrI7nF28Cgst9oYvg bzIKPfgmYV7mXWEez0MRmSAWq5fPQH++9Ifgof7wlWpoqClsl6O3klH5LZtCgPrP3K7g Jet2wjJG16aAlZnoh6ScWsN6Py/gRfoktfnmO88NXVXK3kb7e4sxAbumKuNdf0EKCy5n 4tlW4qrAhk2xx2lj74zzTMydrDeOe7FFb/t0enyRYwrKnmE+lT4kw/X6bHanfiEpK6Rj kuUw== X-Gm-Message-State: AJIora/1KK0Cn+lLG4iaKkK9T9lBUkRmkx2bvUxvd7KFfo8mHb39BhS/ T2lF0fl0T+kC0x9XG1LjD5MaOywd2qQX9M4m99xdlVOh+04t++AYHiIj3TAPAB4P5HKFNvdrBHA bHDR0RcMLP3rD67rE7WQ= X-Received: by 2002:a05:6512:3e19:b0:47f:77d8:236c with SMTP id i25-20020a0565123e1900b0047f77d8236cmr4793768lfv.560.1656581693303; Thu, 30 Jun 2022 02:34:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s3Gz3K2UM8tTLBzR72FcfuoO47fJo3eAFc7et/Y1he2KST7kuHweFqW6LjlDZAmFhn3j2OFmKdGqedvd4H+yE= X-Received: by 2002:a05:6512:3e19:b0:47f:77d8:236c with SMTP id i25-20020a0565123e1900b0047f77d8236cmr4793760lfv.560.1656581693051; Thu, 30 Jun 2022 02:34:53 -0700 (PDT) MIME-Version: 1.0 References: <20220630092422.114332-1-usman.tanveer@emumba.com> In-Reply-To: <20220630092422.114332-1-usman.tanveer@emumba.com> From: David Marchand Date: Thu, 30 Jun 2022 11:34:41 +0200 Message-ID: Subject: Re: [PATCH] net/cnxk: fix segmentation fault in telemetry To: Usman Tanveer Cc: dev , Ciara Power , Nithin Dabilpuram , Kiran Kumar Kokkilagadda , Sunil Kumar Kori , Satha Rao Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Jun 30, 2022 at 11:24 AM Usman Tanveer 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 > --- > 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