bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] ipc/mach_debug.c (host_ipc_hash_info): quiet GCC warning abo


From: Marin Ramesa
Subject: [PATCH 2/3] ipc/mach_debug.c (host_ipc_hash_info): quiet GCC warning about uninitialized variable
Date: Wed, 18 Dec 2013 09:17:48 +0100

Don't initialize to zero, rather move the initialization of size before
the break statement. Break on the first iteration should never happen, so the
position of initialization doesn't matter.

* ipc/mach_debug.c (host_ipc_hash_info) (size): Don't initialize to zero.
(host_ipc_hash_info) (size): Move initialization before the break statement.

---
 ipc/mach_debug.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ipc/mach_debug.c b/ipc/mach_debug.c
index dd9057a..d7c454b 100644
--- a/ipc/mach_debug.c
+++ b/ipc/mach_debug.c
@@ -112,7 +112,7 @@ host_ipc_hash_info(
        mach_msg_type_number_t          *countp)
 {
        vm_offset_t addr;
-       vm_size_t size = 0;     /* Suppress gcc warning */
+       vm_size_t size;
        hash_info_bucket_t *info;
        unsigned int potential, actual;
        kern_return_t kr;
@@ -127,6 +127,9 @@ host_ipc_hash_info(
 
        for (;;) {
                actual = ipc_hash_info(info, potential);
+
+               size = round_page(actual * sizeof *info);
+
                if (actual <= potential)
                        break;
 
@@ -135,7 +138,6 @@ host_ipc_hash_info(
                if (info != *infop)
                        kmem_free(ipc_kernel_map, addr, size);
 
-               size = round_page(actual * sizeof *info);
                kr = kmem_alloc_pageable(ipc_kernel_map, &addr, size);
                if (kr != KERN_SUCCESS)
                        return KERN_RESOURCE_SHORTAGE;
-- 
1.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]