Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 7ec3c56 in mainline


Ignore:
Timestamp:
2015-06-04T14:20:19Z (5 years ago)
Author:
Martin Decky <martin@…>
Branches:
master
Children:
87a2f9b
Parents:
315b7e3
Message:

define a contract that the slab cache size needs to be non-zero
zero size would cause a division by zero in comp_objects()
(detected by Coverity as CID 10260)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/mm/slab.c

    r315b7e3 r7ec3c56  
    610610    unsigned int kmflag), size_t (*destructor)(void *obj), unsigned int flags)
    611611{
     612        ASSERT(size > 0);
     613       
    612614        memsetb(cache, sizeof(*cache), 0);
    613615        cache->name = name;
     
    888890        /* Initialize magazine cache */
    889891        _slab_cache_create(&mag_cache, "slab_magazine_t",
    890             sizeof(slab_magazine_t) + SLAB_MAG_SIZE * sizeof(void*),
     892            sizeof(slab_magazine_t) + SLAB_MAG_SIZE * sizeof(void *),
    891893            sizeof(uintptr_t), NULL, NULL, SLAB_CACHE_NOMAGAZINE |
    892894            SLAB_CACHE_SLINSIDE);
Note: See TracChangeset for help on using the changeset viewer.