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 0ed479bd9d474f1d7588f3370fb306a2e000ff4f (commit) via 483af96a7a14885694496843551ed8fad708192c (commit) via f59d87a65cf1d08f8715a01dceeaf370a29e51f3 (commit) from 3528ca70668da492a2f1fe85c167b2024406dd8d (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 0ed479bd9d474f1d7588f3370fb306a2e000ff4f Author: Bill Fischofer bill.fischofer@linaro.org Date: Thu Feb 2 18:28:02 2017 -0600
helper: tables: avoid invalid odp_shm_addr() calls
In the various table lookup routines, check that odp_shm_lookup() returns a valid handle before attempting to dereference it via odp_shm_addr().
Signed-off-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/helper/cuckootable.c b/helper/cuckootable.c index 6a7fb21..80ff498 100644 --- a/helper/cuckootable.c +++ b/helper/cuckootable.c @@ -151,12 +151,15 @@ align32pow2(uint32_t x) odph_table_t odph_cuckoo_table_lookup(const char *name) { - odph_cuckoo_table_impl *tbl; + odph_cuckoo_table_impl *tbl = NULL; + odp_shm_t shm;
if (name == NULL || strlen(name) >= ODPH_TABLE_NAME_LEN) return NULL;
- tbl = (odph_cuckoo_table_impl *)odp_shm_addr(odp_shm_lookup(name)); + shm = odp_shm_lookup(name); + if (shm != ODP_SHM_INVALID) + tbl = (odph_cuckoo_table_impl *)odp_shm_addr(shm); if (!tbl || tbl->magicword != ODPH_CUCKOO_TABLE_MAGIC_WORD) return NULL;
diff --git a/helper/hashtable.c b/helper/hashtable.c index 1c2b852..9d41144 100644 --- a/helper/hashtable.c +++ b/helper/hashtable.c @@ -150,12 +150,15 @@ int odph_hash_table_destroy(odph_table_t table)
odph_table_t odph_hash_table_lookup(const char *name) { - odph_hash_table_imp *hash_tbl; + odph_hash_table_imp *hash_tbl = NULL; + odp_shm_t shm;
if (name == NULL || strlen(name) >= ODPH_TABLE_NAME_LEN) return NULL;
- hash_tbl = (odph_hash_table_imp *)odp_shm_addr(odp_shm_lookup(name)); + shm = odp_shm_lookup(name); + if (shm != ODP_SHM_INVALID) + hash_tbl = (odph_hash_table_imp *)odp_shm_addr(shm); if (hash_tbl != NULL && strcmp(hash_tbl->name, name) == 0) return (odph_table_t)hash_tbl; return NULL; diff --git a/helper/iplookuptable.c b/helper/iplookuptable.c index 9abdab2..aae2199 100644 --- a/helper/iplookuptable.c +++ b/helper/iplookuptable.c @@ -419,11 +419,14 @@ odph_table_t odph_iplookup_table_lookup(const char *name) { odph_iplookup_table_impl *tbl = NULL; + odp_shm_t shm;
if (name == NULL || strlen(name) >= ODPH_TABLE_NAME_LEN) return NULL;
- tbl = (odph_iplookup_table_impl *)odp_shm_addr(odp_shm_lookup(name)); + shm = odp_shm_lookup(name); + if (shm != ODP_SHM_INVALID) + tbl = (odph_iplookup_table_impl *)odp_shm_addr(shm);
if ( tbl != NULL && diff --git a/helper/lineartable.c b/helper/lineartable.c index e1a396c..32c4956 100644 --- a/helper/lineartable.c +++ b/helper/lineartable.c @@ -128,12 +128,15 @@ int odph_linear_table_destroy(odph_table_t table)
odph_table_t odph_linear_table_lookup(const char *name) { - odph_linear_table_imp *tbl; + odph_linear_table_imp *tbl = NULL; + odp_shm_t shm;
if (name == NULL || strlen(name) >= ODPH_TABLE_NAME_LEN) return NULL;
- tbl = (odph_linear_table_imp *)odp_shm_addr(odp_shm_lookup(name)); + shm = odp_shm_lookup(name); + if (shm != ODP_SHM_INVALID) + tbl = (odph_linear_table_imp *)odp_shm_addr(shm);
/* check magicword to make sure the memory block is used by a table */ if (tbl != NULL &&
commit 483af96a7a14885694496843551ed8fad708192c Author: Bill Fischofer bill.fischofer@linaro.org Date: Thu Feb 2 18:28:01 2017 -0600
helper: iplookuptable: removed unused variable
Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2829 by avoiding unused variable.
Signed-off-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/helper/iplookuptable.c b/helper/iplookuptable.c index 845125b..9abdab2 100644 --- a/helper/iplookuptable.c +++ b/helper/iplookuptable.c @@ -639,11 +639,9 @@ prefix_insert_iter( /* If this entry contains a nexthop and a small cidr, * push it to the next level. */ - if (entry->cidr > 0) { - state = prefix_insert_into_lx( - tbl, ne, entry->cidr, - push, entry->cidr + 8); - } + if (entry->cidr > 0) + (void)prefix_insert_into_lx(tbl, ne, entry->cidr, + push, entry->cidr + 8); }
ne += (ip >> 24);
commit f59d87a65cf1d08f8715a01dceeaf370a29e51f3 Author: Bill Fischofer bill.fischofer@linaro.org Date: Thu Feb 2 18:28:00 2017 -0600
helper: cuckootable: avoid storage leaks on error paths
Ensure that malloced storage areas are freed on error paths. This resolves Bug https://bugs.linaro.org/show_bug.cgi?id=2830
Signed-off-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/helper/test/cuckootable.c b/helper/test/cuckootable.c index 002e52e..be65591 100644 --- a/helper/test/cuckootable.c +++ b/helper/test/cuckootable.c @@ -453,10 +453,15 @@ static int test_performance(int number) unsigned key_num = key_len * elem_num;
key_space = (uint8_t *)malloc(key_num); - key_ptr = (const void **)malloc(sizeof(void *) * elem_num); if (key_space == NULL) return -ENOENT;
+ key_ptr = (const void **)malloc(sizeof(void *) * elem_num); + if (key_ptr == NULL) { + free(key_space); + return -ENOENT; + } + for (j = 0; j < key_num; j++) { key_space[j] = rand() % 255; if (j % key_len == 0) @@ -473,6 +478,8 @@ static int test_performance(int number) "performance_test", PERFORMANCE_CAPACITY, key_len, 0); if (table == NULL) { printf("cuckoo table creation failed\n"); + free(key_ptr); + free(key_space); return -ENOENT; }
-----------------------------------------------------------------------
Summary of changes: helper/cuckootable.c | 7 +++++-- helper/hashtable.c | 7 +++++-- helper/iplookuptable.c | 13 +++++++------ helper/lineartable.c | 7 +++++-- helper/test/cuckootable.c | 9 ++++++++- 5 files changed, 30 insertions(+), 13 deletions(-)
hooks/post-receive