git: kernel - Adjust count algorithm a little

Matthew Dillon dillon at
Tue May 18 09:57:06 PDT 2021

commit ec445c86a5f9ce3efce3a66705271bfe48ccee26
Author: Matthew Dillon <dillon at>
Date:   Tue May 18 09:54:24 2021 -0700

    kernel - Adjust count algorithm a little
    * Remove an unnecessary pre-alignment.  The division rounds down and will
      take care of any mis-alignment with regards to calculating the correct
      count value.
    * Theoretically due to the fact that the slab is already aligned, and the
      size is already aligned, and the division rounds down, the count
      calculation will be correct.  However we leave te safety code in and make
      it a bit more robust just in case some programmer messes with the code
      later on.
    Reported-by: James Cook

Summary of changes:
 sys/kern/kern_kmalloc.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list