DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dpdk-dev <dev@dpdk.org>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	 Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	 Satha Rao <skoteshwar@marvell.com>,
	Jerin Jacob <jerinj@marvell.com>
Subject: Re: [PATCH 1/3] common/cnxk: check return value for error
Date: Fri, 18 Feb 2022 09:50:41 +0530	[thread overview]
Message-ID: <CALBAE1ONtrrDcmDT05s4XH4Hup==YmsR76uUz-yDU1gNWjRKEw@mail.gmail.com> (raw)
In-Reply-To: <20220212123820.3394341-1-gmuthukrishn@marvell.com>

On Sat, Feb 12, 2022 at 6:08 PM Gowrishankar Muthukrishnan
<gmuthukrishn@marvell.com> wrote:
>
> This patch fixes coverity issue by adding checks on return values.
>
> Coverity issue: 373628, 374858, 370213, 370215
> Fixes: af75aac78978 ("common/cnxk: support telemetry for NIX")
> Fixes: d61138d4f0e ("drivers: remove direct access to interrupt handle")
> Fixes: fcdef46b669 ("common/cnxk: support NIX TM debug and misc utils")
> Fixes: df405df95ee ("common/cnxk: add NIX TM helper to alloc/free resource")
>
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>

Series Acked-by: Jerin Jacob <jerinj@marvell.com>
Series applied to dpdk-next-net-mrvl/for-next-net. Thanks.

> ---
>  drivers/common/cnxk/cnxk_telemetry_nix.c | 3 +++
>  drivers/common/cnxk/roc_irq.c            | 5 ++++-
>  drivers/common/cnxk/roc_nix_debug.c      | 4 +++-
>  drivers/common/cnxk/roc_nix_tm.c         | 6 ++++--
>  4 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/common/cnxk/cnxk_telemetry_nix.c b/drivers/common/cnxk/cnxk_telemetry_nix.c
> index df6458039d..4119e9ee4f 100644
> --- a/drivers/common/cnxk/cnxk_telemetry_nix.c
> +++ b/drivers/common/cnxk/cnxk_telemetry_nix.c
> @@ -765,6 +765,9 @@ cnxk_nix_tel_handle_info_x(const char *cmd, const char *params,
>
>         plt_strlcpy(buf, params, PCI_PRI_STR_SIZE + 1);
>         name = strtok(buf, ",");
> +       if (name == NULL)
> +               goto exit;
> +
>         param = strtok(NULL, "\0");
>
>         node = nix_tel_node_get_by_pcidev_name(name);
> diff --git a/drivers/common/cnxk/roc_irq.c b/drivers/common/cnxk/roc_irq.c
> index 7a24297d72..010b121176 100644
> --- a/drivers/common/cnxk/roc_irq.c
> +++ b/drivers/common/cnxk/roc_irq.c
> @@ -160,7 +160,10 @@ dev_irq_register(struct plt_intr_handle *intr_handle, plt_intr_callback_fn cb,
>                 return rc;
>         }
>
> -       plt_intr_efds_index_set(intr_handle, vec, fd);
> +       rc = plt_intr_efds_index_set(intr_handle, vec, fd);
> +       if (rc)
> +               return rc;
> +
>         nb_efd = (vec > (uint32_t)plt_intr_nb_efd_get(intr_handle)) ?
>                 vec : (uint32_t)plt_intr_nb_efd_get(intr_handle);
>         plt_intr_nb_efd_set(intr_handle, nb_efd);
> diff --git a/drivers/common/cnxk/roc_nix_debug.c b/drivers/common/cnxk/roc_nix_debug.c
> index d5143882f5..1ae045172e 100644
> --- a/drivers/common/cnxk/roc_nix_debug.c
> +++ b/drivers/common/cnxk/roc_nix_debug.c
> @@ -52,7 +52,9 @@ nix_bitmap_dump(struct plt_bitmap *bmp)
>         int i;
>
>         plt_bitmap_scan_init(bmp);
> -       plt_bitmap_scan(bmp, &pos, &slab);
> +       if (!plt_bitmap_scan(bmp, &pos, &slab))
> +               return;
> +
>         start_pos = pos;
>
>         nix_dump_no_nl("  \t\t[");
> diff --git a/drivers/common/cnxk/roc_nix_tm.c b/drivers/common/cnxk/roc_nix_tm.c
> index a0448bec61..517502b1af 100644
> --- a/drivers/common/cnxk/roc_nix_tm.c
> +++ b/drivers/common/cnxk/roc_nix_tm.c
> @@ -1016,8 +1016,10 @@ nix_tm_assign_hw_id(struct nix *nix, struct nix_tm_node *parent,
>                         return -EFAULT;
>                 }
>
> -               if (!slab)
> -                       plt_bitmap_scan(bmp, &pos, &slab);
> +               if (!slab) {
> +                       if (!plt_bitmap_scan(bmp, &pos, &slab))
> +                               return -ENOENT;
> +               }
>
>                 if (child->priority == parent->rr_prio && spare_schq != -1) {
>                         /* Use spare schq first if present */
> --
> 2.25.1
>

      parent reply	other threads:[~2022-02-18  4:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-12 12:38 Gowrishankar Muthukrishnan
2022-02-12 12:38 ` [PATCH 2/3] common/cnx: fix unintended sign extension Gowrishankar Muthukrishnan
2022-02-12 12:38 ` [PATCH 3/3] common/cnxk: fix uninitialized pointer read Gowrishankar Muthukrishnan
2022-02-18  4:20 ` Jerin Jacob [this message]

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='CALBAE1ONtrrDcmDT05s4XH4Hup==YmsR76uUz-yDU1gNWjRKEw@mail.gmail.com' \
    --to=jerinjacobk@gmail.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=gmuthukrishn@marvell.com \
    --cc=jerinj@marvell.com \
    --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).