aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2022-09-02 14:34:36 +0000
committerMauro Sardara <msardara@cisco.com>2022-09-02 14:42:53 +0000
commitcb6f5724b85e51295498a39144ed4ccce114ad53 (patch)
tree090b6753d305fd7bc25b84879b63581bbec3b38c /hicn-plugin
parent00a6f92b97a0456259163ade2085defdebeb3f84 (diff)
fix(sonar): make sonarqube happy
Ref: HICN-766 HICN-767 HICN-764 HICN-762 HICN-743 HICN-759 HICN-760 HICN-758 HICN-761 HICN-756 Change-Id: Ic2accf6b6771c7a78d2b22d9bdb8e5a5be9ead8a Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'hicn-plugin')
-rw-r--r--hicn-plugin/src/cli.c2
-rw-r--r--hicn-plugin/src/pcs.h5
-rw-r--r--hicn-plugin/src/test/vpp.c20
3 files changed, 22 insertions, 5 deletions
diff --git a/hicn-plugin/src/cli.c b/hicn-plugin/src/cli.c
index 70fe3307a..de1372b10 100644
--- a/hicn-plugin/src/cli.c
+++ b/hicn-plugin/src/cli.c
@@ -566,7 +566,7 @@ hicn_cli_pgen_server_set_command_fn (vlib_main_t *vm,
int payload_size = 1440;
u32 sw_if_index = ~0;
vnet_main_t *vnm = vnet_get_main ();
- fib_prefix_t prefix;
+ fib_prefix_t prefix = {};
u32 hicnpg_server_index;
ip46_address_t locator;
diff --git a/hicn-plugin/src/pcs.h b/hicn-plugin/src/pcs.h
index f9cb7bd91..0b7635100 100644
--- a/hicn-plugin/src/pcs.h
+++ b/hicn-plugin/src/pcs.h
@@ -634,7 +634,10 @@ hicn_pcs_lookup_one (hicn_pit_cs_t *pitcs, const hicn_name_t *name,
}
// Retrieve entry from pool
- *pcs_entry = hicn_pcs_entry_get_entry_from_index (pitcs, kv.value);
+ *pcs_entry = hicn_pcs_entry_get_entry_from_index (pitcs, (u32) (kv.value));
+
+ // If the search is successful, we MUST find the entry in the pool.
+ ALWAYS_ASSERT (*pcs_entry);
// If entry found and it is a CS entry, let's update the LRU
if (hicn_pcs_entry_is_cs (*pcs_entry))
diff --git a/hicn-plugin/src/test/vpp.c b/hicn-plugin/src/test/vpp.c
index fc96e6e16..761e55759 100644
--- a/hicn-plugin/src/test/vpp.c
+++ b/hicn-plugin/src/test/vpp.c
@@ -190,11 +190,17 @@ vpp_init_internal (int argc, char *argv[])
argc_++;
char **tmp = realloc (argv_, argc_ * sizeof (char *));
if (tmp == NULL)
- return 1;
+ {
+ fclose (fp);
+ return 1;
+ }
argv_ = tmp;
arg = strndup (p, 1024);
if (arg == NULL)
- return 1;
+ {
+ free (argv_);
+ return 1;
+ }
argv_[argc_ - 1] = arg;
p = strtok (NULL, " \t\n");
}
@@ -204,7 +210,10 @@ vpp_init_internal (int argc, char *argv[])
char **tmp = realloc (argv_, (argc_ + 1) * sizeof (char *));
if (tmp == NULL)
- return 1;
+ {
+ free (argv_);
+ return 1;
+ }
argv_ = tmp;
argv_[argc_] = NULL;
@@ -540,6 +549,11 @@ vpp_init ()
ASSERT (ret < BUFFER_LEN);
+ if (ret >= BUFFER_LEN)
+ {
+ return -1;
+ }
+
buffer[ret] = '\0';
char *argv[N_ARGS] = { buffer, "unix { nodaemon }", NULL };