[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH gnumach 2/3] kern: silence compiler warning about uninitializ
From: |
Samuel Thibault |
Subject: |
Re: [PATCH gnumach 2/3] kern: silence compiler warning about uninitialized variable |
Date: |
Tue, 30 Sep 2014 14:22:33 +0200 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Justus Winter, le Tue 30 Sep 2014 14:06:17 +0200, a écrit :
> * kern/slab.c (kmem_cache_compute_sizes): Initialize optimal_size and
> assert that a size is selected.
Ack.
> ---
> kern/slab.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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;
> --
> 2.1.0
>
>
--
Samuel
"And the next time you consider complaining that running Lucid Emacs
19.05 via NFS from a remote Linux machine in Paraguay doesn't seem to
get the background colors right, you'll know who to thank."
(By Matt Welsh)