[systemd-commits] src/network

Tom Gundersen tomegun at kemper.freedesktop.org
Fri May 23 15:48:06 PDT 2014


 src/network/sd-network.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 68baa8faf30f4e097bcf32d5b2d4880f85a0bdc7
Author: Tom Gundersen <teg at jklm.no>
Date:   Sat May 24 00:46:30 2014 +0200

    sd-network: avoid false positive compiler warning caused by LTO
    
    Djalal Harouni <tixxdz at opendz.org>:
    There is also this one genrated by LTO, IMO it's a false positive since
    we do *check* for "lease" but the code is not consistent since in that
    code path, "lease" is initialized to NULL in other places, except for
    this one:
    
    src/resolve/resolved-manager.c: In function 'manager_update_resolv_conf':
    src/libsystemd-network/sd-dhcp-lease.c:67:18: warning: 'lease' may be used uninitialized in this function [-Wmaybe-uninitialized]
            if (lease->dns_size) {
                     ^
    src/network/sd-network.c:146:24: note: 'lease' was declared here
            sd_dhcp_lease *lease;
                           ^

diff --git a/src/network/sd-network.c b/src/network/sd-network.c
index e7cda0d..ba13a30 100644
--- a/src/network/sd-network.c
+++ b/src/network/sd-network.c
@@ -143,7 +143,7 @@ _public_ int sd_network_get_link_operational_state(unsigned index, char **state)
 
 _public_ int sd_network_get_dhcp_lease(unsigned index, sd_dhcp_lease **ret) {
         _cleanup_free_ char *p = NULL, *s = NULL;
-        sd_dhcp_lease *lease;
+        sd_dhcp_lease *lease = NULL;
         int r;
 
         assert_return(index, -EINVAL);



More information about the systemd-commits mailing list