This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Stefan Sperling gerrit-no-reply at lists.osmocom.orgStefan Sperling has submitted this change and it was merged. ( https://gerrit.osmocom.org/11858 ) Change subject: fix allocation of ippool's hash table ...................................................................... fix allocation of ippool's hash table The calloc() call in ippool_new() had two problems. The first problem is benign: The order of arguments were reversed. Pass the number of elements in the array first, then the size of each element, as calloc() expects. This problem was found by me. There are more instances of this problem in this file, which I'll address in follow-up patches. The second problem is that the requested allocation was larger than necessary: The hash table is an array of pointers to ippoolm_t, not an array of struct ippoolm_t. Fix the required size passed to calloc(). This problem was found by Coverity. Change-Id: I93fa5bc539771ca19714f6a665558c9140e2ce07 Related: CID#57920 --- M lib/ippool.c 1 file changed, 2 insertions(+), 3 deletions(-) Approvals: Pau Espin Pedrol: Looks good to me, approved Jenkins Builder: Verified diff --git a/lib/ippool.c b/lib/ippool.c index 6561f1f..6ce3cda 100644 --- a/lib/ippool.c +++ b/lib/ippool.c @@ -276,9 +276,8 @@ (*this)->hashmask = (*this)->hashsize - 1; /* Allocate hash table */ - if (! - ((*this)->hash = - calloc(sizeof(struct ippoolm_t), (*this)->hashsize))) { + (*this)->hash = calloc((*this)->hashsize, sizeof(struct ippoolm_t *)); + if (!(*this)->hash) { SYS_ERR(DIP, LOGL_ERROR, 0, "Failed to allocate memory for hash members in ippool"); return -1; -- To view, visit https://gerrit.osmocom.org/11858 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ggsn Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I93fa5bc539771ca19714f6a665558c9140e2ce07 Gerrit-Change-Number: 11858 Gerrit-PatchSet: 2 Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de> Gerrit-Reviewer: Jenkins Builder (1000002) Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de> Gerrit-Reviewer: Stefan Sperling <ssperling at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181122/8619e678/attachment.htm>