This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, master has been updated via d9fb340f78366750b7b519a1e838f73672428870 (commit) via 60d0a8cef06f7d5c2dcfceea69a6339613315654 (commit) from 7cc385173deacea5641f1e6df8200c7057446ff8 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit d9fb340f78366750b7b519a1e838f73672428870 Author: Matias Elo matias.elo@nokia.com Date: Tue Feb 19 13:13:04 2019 +0200
test: check odp_shm_reserve() return value
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com
diff --git a/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c b/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c index 75ea0a7a..563d3d64 100644 --- a/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c +++ b/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c @@ -172,6 +172,11 @@ int main(int argc, char **argv) /* Reserve memory for args from shared mem */ shm = odp_shm_reserve("_appl_global_data", sizeof(global_data_t), ODP_CACHE_LINE_SIZE, 0); + if (shm == ODP_SHM_INVALID) { + printf("Error: shared mem alloc failed.\n"); + exit(EXIT_FAILURE); + } + global = odp_shm_addr(shm); if (global == NULL) { printf("Error: shared mem alloc failed.\n"); diff --git a/test/performance/odp_cpu_bench.c b/test/performance/odp_cpu_bench.c index 852ed308..4c36aca1 100644 --- a/test/performance/odp_cpu_bench.c +++ b/test/performance/odp_cpu_bench.c @@ -578,6 +578,11 @@ int main(int argc, char *argv[])
shm = odp_shm_reserve("shm_args", sizeof(args_t), ODP_CACHE_LINE_SIZE, 0); + if (shm == ODP_SHM_INVALID) { + LOG_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + gbl_args = odp_shm_addr(shm); if (gbl_args == NULL) { LOG_ERR("Error: shared mem alloc failed\n"); @@ -592,6 +597,11 @@ int main(int argc, char *argv[]) sizeof(lookup_entry_t) * gbl_args->appl.lookup_tbl_size, ODP_CACHE_LINE_SIZE, 0); + if (lookup_tbl_shm == ODP_SHM_INVALID) { + LOG_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + gbl_args->lookup_tbl = odp_shm_addr(lookup_tbl_shm); if (gbl_args->lookup_tbl == NULL) { LOG_ERR("Error: lookup table mem alloc failed\n"); diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 78e3920f..15a0cb0e 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -1484,6 +1484,12 @@ int main(int argc, char *argv[]) /* Reserve memory for args from shared mem */ shm = odp_shm_reserve("shm_args", sizeof(args_t), ODP_CACHE_LINE_SIZE, 0); + + if (shm == ODP_SHM_INVALID) { + LOG_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + gbl_args = odp_shm_addr(shm);
if (gbl_args == NULL) { diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 2ed2c352..55e90566 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -1062,6 +1062,9 @@ int main(int argc, char **argv)
shm = odp_shm_reserve("test_globals", sizeof(test_globals_t), ODP_CACHE_LINE_SIZE, 0); + if (shm == ODP_SHM_INVALID) + LOG_ABORT("Shared memory reserve failed.\n"); + gbl_args = odp_shm_addr(shm); if (gbl_args == NULL) LOG_ABORT("Shared memory reserve failed.\n"); @@ -1076,6 +1079,8 @@ int main(int argc, char **argv) shm = odp_shm_reserve("test_globals.rx_stats", gbl_args->rx_stats_size, ODP_CACHE_LINE_SIZE, 0); + if (shm == ODP_SHM_INVALID) + LOG_ABORT("Shared memory reserve failed.\n");
gbl_args->rx_stats = odp_shm_addr(shm);
@@ -1087,6 +1092,8 @@ int main(int argc, char **argv) shm = odp_shm_reserve("test_globals.tx_stats", gbl_args->tx_stats_size, ODP_CACHE_LINE_SIZE, 0); + if (shm == ODP_SHM_INVALID) + LOG_ABORT("Shared memory reserve failed.\n");
gbl_args->tx_stats = odp_shm_addr(shm);
diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index c128580d..b7128c1f 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -2010,6 +2010,11 @@ static int scheduler_suite_init(void) shm = odp_shm_reserve(GLOBALS_SHM_NAME, sizeof(test_globals_t), ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) { + printf("Shared memory reserve failed (globals).\n"); + return -1; + } + globals = odp_shm_addr(shm);
if (!globals) { @@ -2027,6 +2032,12 @@ static int scheduler_suite_init(void)
shm = odp_shm_reserve(SHM_THR_ARGS_NAME, sizeof(thread_args_t), ODP_CACHE_LINE_SIZE, 0); + + if (shm == ODP_SHM_INVALID) { + printf("Shared memory reserve failed (args).\n"); + return -1; + } + args = odp_shm_addr(shm);
if (!args) {
commit 60d0a8cef06f7d5c2dcfceea69a6339613315654 Author: Matias Elo matias.elo@nokia.com Date: Tue Feb 19 13:05:12 2019 +0200
example: check odp_shm_reserve() return value
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index bd6af795..48292702 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -1142,6 +1142,12 @@ int main(int argc, char *argv[]) /* Reserve memory for args from shared mem */ shm = odp_shm_reserve("shm_args", sizeof(args_t), ODP_CACHE_LINE_SIZE, 0); + + if (shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + args = odp_shm_addr(shm);
if (args == NULL) { diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 1bbf7a00..d1189881 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1235,6 +1235,11 @@ main(int argc, char *argv[]) shm = odp_shm_reserve("shm_args", sizeof(global_data_t), ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + global = odp_shm_addr(shm);
if (NULL == global) { diff --git a/example/ipsec/odp_ipsec_fwd_db.c b/example/ipsec/odp_ipsec_fwd_db.c index da9abf94..5e84656a 100644 --- a/example/ipsec/odp_ipsec_fwd_db.c +++ b/example/ipsec/odp_ipsec_fwd_db.c @@ -30,6 +30,11 @@ void init_fwd_db(void) ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + fwd_db = odp_shm_addr(shm);
if (fwd_db == NULL) { diff --git a/example/ipsec/odp_ipsec_sa_db.c b/example/ipsec/odp_ipsec_sa_db.c index 626380c6..0c6fdf51 100644 --- a/example/ipsec/odp_ipsec_sa_db.c +++ b/example/ipsec/odp_ipsec_sa_db.c @@ -33,6 +33,11 @@ void init_sa_db(void) ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + sa_db = odp_shm_addr(shm);
if (sa_db == NULL) { @@ -50,6 +55,12 @@ void init_tun_db(void) sizeof(tun_db_t), ODP_CACHE_LINE_SIZE, 0); + + if (shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + tun_db = odp_shm_addr(shm);
if (!tun_db) { diff --git a/example/ipsec/odp_ipsec_sp_db.c b/example/ipsec/odp_ipsec_sp_db.c index 265c9c7e..51690ddf 100644 --- a/example/ipsec/odp_ipsec_sp_db.c +++ b/example/ipsec/odp_ipsec_sp_db.c @@ -30,6 +30,11 @@ void init_sp_db(void) ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + sp_db = odp_shm_addr(shm);
if (sp_db == NULL) { diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index 7487dddf..c55dc484 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -48,6 +48,11 @@ void init_stream_db(void) ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + stream_db = odp_shm_addr(shm);
if (stream_db == NULL) { diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index ab0fa3c5..5b83e8b3 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -934,6 +934,11 @@ main(int argc, char *argv[]) shm = odp_shm_reserve("shm_args", sizeof(global_data_t), ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + global = odp_shm_addr(shm);
if (NULL == global) { diff --git a/example/ipsec_api/odp_ipsec_cache.c b/example/ipsec_api/odp_ipsec_cache.c index 62edb9bc..3a28410e 100644 --- a/example/ipsec_api/odp_ipsec_cache.c +++ b/example/ipsec_api/odp_ipsec_cache.c @@ -27,6 +27,11 @@ void init_ipsec_cache(void) ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + ipsec_cache = odp_shm_addr(shm);
if (ipsec_cache == NULL) { diff --git a/example/ipsec_offload/odp_ipsec_offload.c b/example/ipsec_offload/odp_ipsec_offload.c index 4d95b2e5..f6936b33 100644 --- a/example/ipsec_offload/odp_ipsec_offload.c +++ b/example/ipsec_offload/odp_ipsec_offload.c @@ -524,6 +524,10 @@ main(int argc, char *argv[]) /* Reserve memory for arguments from shared memory */ shm = odp_shm_reserve("shm_args", sizeof(global_data_t), ODP_CACHE_LINE_SIZE, 0); + + if (shm == ODP_SHM_INVALID) + EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + global = odp_shm_addr(shm);
if (NULL == global) diff --git a/example/ipsec_offload/odp_ipsec_offload_cache.c b/example/ipsec_offload/odp_ipsec_offload_cache.c index 58271bfd..6f0e0939 100644 --- a/example/ipsec_offload/odp_ipsec_offload_cache.c +++ b/example/ipsec_offload/odp_ipsec_offload_cache.c @@ -33,6 +33,9 @@ void init_ipsec_cache(void) ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) + EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + ipsec_cache = odp_shm_addr(shm);
if (ipsec_cache == NULL) diff --git a/example/ipsec_offload/odp_ipsec_offload_fwd_db.c b/example/ipsec_offload/odp_ipsec_offload_fwd_db.c index f707ab9a..a92a566f 100644 --- a/example/ipsec_offload/odp_ipsec_offload_fwd_db.c +++ b/example/ipsec_offload/odp_ipsec_offload_fwd_db.c @@ -61,6 +61,9 @@ void init_fwd_db(void) ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) + EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + fwd_db = odp_shm_addr(shm);
if (fwd_db == NULL) diff --git a/example/ipsec_offload/odp_ipsec_offload_sa_db.c b/example/ipsec_offload/odp_ipsec_offload_sa_db.c index a0fb3fbf..5c126483 100644 --- a/example/ipsec_offload/odp_ipsec_offload_sa_db.c +++ b/example/ipsec_offload/odp_ipsec_offload_sa_db.c @@ -31,6 +31,9 @@ void init_sa_db(void) ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) + EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + sa_db = odp_shm_addr(shm);
if (sa_db == NULL) @@ -46,6 +49,10 @@ void init_tun_db(void) sizeof(tun_db_t), ODP_CACHE_LINE_SIZE, 0); + + if (shm == ODP_SHM_INVALID) + EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + tun_db = odp_shm_addr(shm);
if (!tun_db) diff --git a/example/ipsec_offload/odp_ipsec_offload_sp_db.c b/example/ipsec_offload/odp_ipsec_offload_sp_db.c index 1001d5f3..cfa8cb94 100644 --- a/example/ipsec_offload/odp_ipsec_offload_sp_db.c +++ b/example/ipsec_offload/odp_ipsec_offload_sp_db.c @@ -28,6 +28,9 @@ void init_sp_db(void) ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) + EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + sp_db = odp_shm_addr(shm);
if (sp_db == NULL) diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c index f7e7ba53..fab00e7e 100644 --- a/example/l2fwd_simple/odp_l2fwd_simple.c +++ b/example/l2fwd_simple/odp_l2fwd_simple.c @@ -174,6 +174,11 @@ int main(int argc, char **argv) /* Reserve memory for args from shared mem */ shm = odp_shm_reserve("_appl_global_data", sizeof(global_data_t), ODP_CACHE_LINE_SIZE, 0); + if (shm == ODP_SHM_INVALID) { + printf("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + global = odp_shm_addr(shm); if (global == NULL) { printf("Error: shared mem alloc failed.\n"); diff --git a/example/l3fwd/odp_l3fwd.c b/example/l3fwd/odp_l3fwd.c index 708c4df9..4bf26586 100644 --- a/example/l3fwd/odp_l3fwd.c +++ b/example/l3fwd/odp_l3fwd.c @@ -968,6 +968,11 @@ int main(int argc, char **argv) /* Reserve memory for args from shared mem */ shm = odp_shm_reserve("_appl_global_data", sizeof(global_data_t), ODP_CACHE_LINE_SIZE, 0); + if (shm == ODP_SHM_INVALID) { + printf("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + global = odp_shm_addr(shm); if (global == NULL) { printf("Error: shared mem alloc failed.\n"); diff --git a/example/l3fwd/odp_l3fwd_db.c b/example/l3fwd/odp_l3fwd_db.c index f39b5430..a27801a5 100644 --- a/example/l3fwd/odp_l3fwd_db.c +++ b/example/l3fwd/odp_l3fwd_db.c @@ -179,7 +179,7 @@ static flow_table_t fwd_lookup_cache; static void create_fwd_hash_cache(void) { odp_shm_t hash_shm; - flow_bucket_t *bucket; + flow_bucket_t *bucket = NULL; flow_entry_t *flows; uint32_t bucket_count, flow_count, size; uint32_t i; @@ -191,8 +191,9 @@ static void create_fwd_hash_cache(void) size = sizeof(flow_bucket_t) * bucket_count + sizeof(flow_entry_t) * flow_count; hash_shm = odp_shm_reserve("flow_table", size, ODP_CACHE_LINE_SIZE, 0); + if (hash_shm != ODP_SHM_INVALID) + bucket = odp_shm_addr(hash_shm);
- bucket = odp_shm_addr(hash_shm); if (!bucket) { /* Try the second time with small request */ flow_count /= 4; @@ -201,6 +202,11 @@ static void create_fwd_hash_cache(void) sizeof(flow_entry_t) * flow_count; hash_shm = odp_shm_reserve("flow_table", size, ODP_CACHE_LINE_SIZE, 0); + if (hash_shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + bucket = odp_shm_addr(hash_shm); if (!bucket) { EXAMPLE_ERR("Error: shared mem alloc failed.\n"); @@ -342,6 +348,11 @@ void init_fwd_db(void) ODP_CACHE_LINE_SIZE, 0);
+ if (shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + fwd_db = odp_shm_addr(shm);
if (fwd_db == NULL) { diff --git a/example/l3fwd/odp_l3fwd_lpm.c b/example/l3fwd/odp_l3fwd_lpm.c index cb9d9df0..f8830339 100644 --- a/example/l3fwd/odp_l3fwd_lpm.c +++ b/example/l3fwd/odp_l3fwd_lpm.c @@ -154,6 +154,11 @@ void fib_tbl_init(void) size = FIB_NEXT_SIZE * FIB_SUB_COUNT; /*Reserve memory for Routing hash table*/ lpm_shm = odp_shm_reserve("fib_lpm_sub", size, ODP_CACHE_LINE_SIZE, 0); + if (lpm_shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + fe = odp_shm_addr(lpm_shm); if (!fe) { EXAMPLE_ERR("Error: shared mem alloc failed for lpm cache.\n"); diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index b1c4a79c..40038d57 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -382,6 +382,11 @@ int main(int argc, char *argv[]) /* Reserve memory for args from shared mem */ shm = odp_shm_reserve("_appl_global_data", sizeof(args_t), ODP_CACHE_LINE_SIZE, 0); + if (shm == ODP_SHM_INVALID) { + EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + args = odp_shm_addr(shm); if (args == NULL) { EXAMPLE_ERR("Error: shared mem alloc failed.\n"); diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c index a0162145..c922f7ef 100644 --- a/example/switch/odp_switch.c +++ b/example/switch/odp_switch.c @@ -908,6 +908,12 @@ int main(int argc, char **argv) /* Reserve memory for args from shared mem */ shm = odp_shm_reserve("shm_args", sizeof(args_t), ODP_CACHE_LINE_SIZE, 0); + + if (shm == ODP_SHM_INVALID) { + printf("Error: shared mem reserve failed.\n"); + exit(EXIT_FAILURE); + } + gbl_args = odp_shm_addr(shm);
if (gbl_args == NULL) {
-----------------------------------------------------------------------
Summary of changes: example/generator/odp_generator.c | 6 ++++++ example/ipsec/odp_ipsec.c | 5 +++++ example/ipsec/odp_ipsec_fwd_db.c | 5 +++++ example/ipsec/odp_ipsec_sa_db.c | 11 +++++++++++ example/ipsec/odp_ipsec_sp_db.c | 5 +++++ example/ipsec/odp_ipsec_stream.c | 5 +++++ example/ipsec_api/odp_ipsec.c | 5 +++++ example/ipsec_api/odp_ipsec_cache.c | 5 +++++ example/ipsec_offload/odp_ipsec_offload.c | 4 ++++ example/ipsec_offload/odp_ipsec_offload_cache.c | 3 +++ example/ipsec_offload/odp_ipsec_offload_fwd_db.c | 3 +++ example/ipsec_offload/odp_ipsec_offload_sa_db.c | 7 +++++++ example/ipsec_offload/odp_ipsec_offload_sp_db.c | 3 +++ example/l2fwd_simple/odp_l2fwd_simple.c | 5 +++++ example/l3fwd/odp_l3fwd.c | 5 +++++ example/l3fwd/odp_l3fwd_db.c | 15 +++++++++++++-- example/l3fwd/odp_l3fwd_lpm.c | 5 +++++ example/packet/odp_pktio.c | 5 +++++ example/switch/odp_switch.c | 6 ++++++ platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c | 5 +++++ test/performance/odp_cpu_bench.c | 10 ++++++++++ test/performance/odp_l2fwd.c | 6 ++++++ test/performance/odp_pktio_perf.c | 7 +++++++ test/validation/api/scheduler/scheduler.c | 11 +++++++++++ 24 files changed, 145 insertions(+), 2 deletions(-)
hooks/post-receive