]> git.droids-corp.org - dpdk.git/commitdiff
common/cnxk: add missing checks of return values
authorGowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Sat, 12 Feb 2022 12:38:18 +0000 (18:08 +0530)
committerJerin Jacob <jerinj@marvell.com>
Fri, 18 Feb 2022 04:09:16 +0000 (05:09 +0100)
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: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
Fixes: fcdef46b6698 ("common/cnxk: support NIX TM debug and misc utils")
Fixes: df405df95eeb ("common/cnxk: add NIX TM helper to alloc/free resource")
Cc: stable@dpdk.org
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/common/cnxk/cnxk_telemetry_nix.c
drivers/common/cnxk/roc_irq.c
drivers/common/cnxk/roc_nix_debug.c
drivers/common/cnxk/roc_nix_tm.c

index df6458039dc44a2cc6ca68b7f694973faa1bf24e..4119e9ee4f28db416a2d64574d77983f8cfdc726 100644 (file)
@@ -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);
index 7a24297d728c1312fd91f40569b3aed09f809d1a..010b121176b97c05894ef924f5ed4f0e36fa7c40 100644 (file)
@@ -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);
index d5143882f5888cd0663d85ed0c5bbc1e31728f73..1ae045172e29f2416646e3175721c454d87da507 100644 (file)
@@ -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[");
index a0448bec6123b7cc29fe1b1f44c482a67c8688f8..517502b1af50c7b4097f32d2a2f267b7dbd5c4cd 100644 (file)
@@ -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 */