For security, any data structure with function pointers should be const Signed-off-by: David Hunt <david.hunt at intel.com> --- lib/librte_mempool/rte_mempool.h | 2 +- lib/librte_mempool/rte_mempool_default.c | 8 ++++---- lib/librte_mempool/rte_mempool_handler.c | 2 +- lib/librte_mempool/rte_mempool_stack.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index ed2c110..baa5f48 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -491,7 +491,7 @@ rte_mempool_set_handler(struct rte_mempool *mp, const char *name); * - >=0: Sucess; return the index of the handler in the table. * - <0: Error (errno) */ -int rte_mempool_handler_register(struct rte_mempool_handler *h); +int rte_mempool_handler_register(const struct rte_mempool_handler *h); /** * Macro to statically register an external pool handler. diff --git a/lib/librte_mempool/rte_mempool_default.c b/lib/librte_mempool/rte_mempool_default.c index a6ac65a..764f772 100644 --- a/lib/librte_mempool/rte_mempool_default.c +++ b/lib/librte_mempool/rte_mempool_default.c @@ -105,7 +105,7 @@ common_ring_free(void *p) rte_ring_free((struct rte_ring *)p); } -static struct rte_mempool_handler handler_mp_mc = { +static const struct rte_mempool_handler handler_mp_mc = { .name = "ring_mp_mc", .alloc = common_ring_alloc, .free = common_ring_free, @@ -114,7 +114,7 @@ static struct rte_mempool_handler handler_mp_mc = { .get_count = common_ring_get_count, }; -static struct rte_mempool_handler handler_sp_sc = { +static const struct rte_mempool_handler handler_sp_sc = { .name = "ring_sp_sc", .alloc = common_ring_alloc, .free = common_ring_free, @@ -123,7 +123,7 @@ static struct rte_mempool_handler handler_sp_sc = { .get_count = common_ring_get_count, }; -static struct rte_mempool_handler handler_mp_sc = { +static const struct rte_mempool_handler handler_mp_sc = { .name = "ring_mp_sc", .alloc = common_ring_alloc, .free = common_ring_free, @@ -132,7 +132,7 @@ static struct rte_mempool_handler handler_mp_sc = { .get_count = common_ring_get_count, }; -static struct rte_mempool_handler handler_sp_mc = { +static const struct rte_mempool_handler handler_sp_mc = { .name = "ring_sp_mc", .alloc = common_ring_alloc, .free = common_ring_free, diff --git a/lib/librte_mempool/rte_mempool_handler.c b/lib/librte_mempool/rte_mempool_handler.c index 78611f8..eab1e69 100644 --- a/lib/librte_mempool/rte_mempool_handler.c +++ b/lib/librte_mempool/rte_mempool_handler.c @@ -45,7 +45,7 @@ struct rte_mempool_handler_table rte_mempool_handler_table = { /* add a new handler in rte_mempool_handler_table, return its index */ int -rte_mempool_handler_register(struct rte_mempool_handler *h) +rte_mempool_handler_register(const struct rte_mempool_handler *h) { struct rte_mempool_handler *handler; int16_t handler_idx; diff --git a/lib/librte_mempool/rte_mempool_stack.c b/lib/librte_mempool/rte_mempool_stack.c index 6e25028..ad49436 100644 --- a/lib/librte_mempool/rte_mempool_stack.c +++ b/lib/librte_mempool/rte_mempool_stack.c @@ -133,7 +133,7 @@ common_stack_free(void *p) rte_free(p); } -static struct rte_mempool_handler handler_stack = { +static const struct rte_mempool_handler handler_stack = { .name = "stack", .alloc = common_stack_alloc, .free = common_stack_free, -- 2.5.5