[ovs-dev] [PATCH ovn] northd: Fix order of calloc arguments.
It doesn't affect the allocation size, but the number of elements should go before the size of these elements. Fixes: 74daa0607c7f ("ovn-northd: Introduce parallel lflow build") Signed-off-by: Ilya Maximets --- northd/northd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/northd/northd.c b/northd/northd.c index 0a749931e..ea95f6a5c 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -15832,7 +15832,7 @@ build_lswitch_and_lrouter_flows(const struct ovn_datapaths *ls_datapaths, struct lswitch_flow_build_info *lsiv; int index; -lsiv = xcalloc(sizeof(*lsiv), build_lflows_pool->size); +lsiv = xcalloc(build_lflows_pool->size, sizeof *lsiv); /* Set up "work chunks" for each thread to work on. */ -- 2.40.1 ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH ovn] northd: Fix order of calloc arguments.
Thanks for the change, Ilya. I'm not so sure about this. If there were other related changes in this region of code, then also swapping the arguments would make sense. But on its own, this doesn't fix anything, and it doesn't add any improvements. The only thing I think this might do is cause a headache when trying to apply backports to changes that touch this area of code. I can be convinced otherwise, but currently, I don't see a good reason to merge this. On 8/23/23 18:03, Ilya Maximets wrote: It doesn't affect the allocation size, but the number of elements should go before the size of these elements. Fixes: 74daa0607c7f ("ovn-northd: Introduce parallel lflow build") Signed-off-by: Ilya Maximets --- northd/northd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/northd/northd.c b/northd/northd.c index 0a749931e..ea95f6a5c 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -15832,7 +15832,7 @@ build_lswitch_and_lrouter_flows(const struct ovn_datapaths *ls_datapaths, struct lswitch_flow_build_info *lsiv; int index; -lsiv = xcalloc(sizeof(*lsiv), build_lflows_pool->size); +lsiv = xcalloc(build_lflows_pool->size, sizeof *lsiv); /* Set up "work chunks" for each thread to work on. */ ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Re: [ovs-dev] [PATCH ovn] northd: Fix order of calloc arguments.
On 8/24/23 21:02, Mark Michelson wrote: > Thanks for the change, Ilya. > > I'm not so sure about this. If there were other related changes in this > region of code, then also swapping the arguments would make sense. But > on its own, this doesn't fix anything, and it doesn't add any > improvements. The only thing I think this might do is cause a headache > when trying to apply backports to changes that touch this area of code. It will not be a problem if this fix is backported. :) > > I can be convinced otherwise, but currently, I don't see a good reason > to merge this. The only concern I have is that issues like this tend to spread if left in the code. But I'm fine with dropping this patch, if you don't think it's necessary. Best regards, Ilya Maximets. > > On 8/23/23 18:03, Ilya Maximets wrote: >> It doesn't affect the allocation size, but the number of elements >> should go before the size of these elements. >> >> Fixes: 74daa0607c7f ("ovn-northd: Introduce parallel lflow build") >> Signed-off-by: Ilya Maximets >> --- >> northd/northd.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/northd/northd.c b/northd/northd.c >> index 0a749931e..ea95f6a5c 100644 >> --- a/northd/northd.c >> +++ b/northd/northd.c >> @@ -15832,7 +15832,7 @@ build_lswitch_and_lrouter_flows(const struct >> ovn_datapaths *ls_datapaths, >> struct lswitch_flow_build_info *lsiv; >> int index; >> >> -lsiv = xcalloc(sizeof(*lsiv), build_lflows_pool->size); >> +lsiv = xcalloc(build_lflows_pool->size, sizeof *lsiv); >> >> /* Set up "work chunks" for each thread to work on. */ >> > ___ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev