summaryrefslogtreecommitdiff
path: root/kern/slab.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-09-30 09:02:25 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-09-30 09:15:08 +0200
commit3166fe0edd4a5cf0d690c094f2fd06647ba380e5 (patch)
tree39cf28d55f75be21ae6f11d252e5a04da8ab78b9 /kern/slab.c
parentdfcdc049242c9ceb75fe82c16a20149244d8abd6 (diff)
kern: silence compiler warning about uninitialized variable
* kern/slab.c (kmem_cache_compute_sizes): Initialize optimal_size and assert that a size is selected.
Diffstat (limited to 'kern/slab.c')
-rw-r--r--kern/slab.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kern/slab.c b/kern/slab.c
index e8451a8..19ebfed 100644
--- a/kern/slab.c
+++ b/kern/slab.c
@@ -702,7 +702,7 @@ static void kmem_cache_error(struct kmem_cache *cache, void *buf, int error,
*/
static void kmem_cache_compute_sizes(struct kmem_cache *cache, int flags)
{
- size_t i, buffers, buf_size, slab_size, free_slab_size, optimal_size;
+ size_t i, buffers, buf_size, slab_size, free_slab_size, optimal_size = 0;
size_t waste, waste_min;
int embed, optimal_embed = 0;
@@ -745,6 +745,7 @@ static void kmem_cache_compute_sizes(struct kmem_cache *cache, int flags)
} while ((buffers < KMEM_MIN_BUFS_PER_SLAB)
&& (slab_size < KMEM_SLAB_SIZE_THRESHOLD));
+ assert(optimal_size > 0);
assert(!(flags & KMEM_CACHE_NOOFFSLAB) || optimal_embed);
cache->slab_size = optimal_size;