discover: Fix potentially-uninitialised variables
authorJeremy Kerr <jk@ozlabs.org>
Fri, 8 Nov 2013 06:23:32 +0000 (14:23 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Wed, 13 Nov 2013 06:25:02 +0000 (14:25 +0800)
We've been compiling with --enable-debug; this change fixes some
problems exposed by the optimiser.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/grub2/script.c
discover/network.c
discover/pxe-parser.c

index 2aaf1d3d2cb1495a63c48fe7d31f72882d921b52..e29d43702b1e0099435ab76b2f3966ad559cee90 100644 (file)
@@ -320,7 +320,7 @@ int statement_if_execute(struct grub2_script *script,
        struct grub2_statement_if *st = to_stmt_if(statement);
        struct grub2_statement *conditional;
        bool executed;
        struct grub2_statement_if *st = to_stmt_if(statement);
        struct grub2_statement *conditional;
        bool executed;
-       int rc;
+       int rc = 0;
 
        list_for_each_entry(&st->conditionals->list, conditional, list) {
                rc = statement_conditional_execute(script,
 
        list_for_each_entry(&st->conditionals->list, conditional, list) {
                rc = statement_conditional_execute(script,
index b9b0c5043f58e3131b0789f1948257051d0f5831..87075fcf91925666ed2b8c13757d13dff45b59fc 100644 (file)
@@ -369,6 +369,7 @@ static int network_handle_nlmsg(struct network *network, struct nlmsghdr *nlmsg)
        info = NLMSG_DATA(nlmsg);
 
        have_ifaddr = have_ifname = false;
        info = NLMSG_DATA(nlmsg);
 
        have_ifaddr = have_ifname = false;
+       mtu = 1;
 
        attrlen = nlmsg->nlmsg_len - sizeof(*info);
 
 
        attrlen = nlmsg->nlmsg_len - sizeof(*info);
 
index bc07a13c54b1ff8eb9884fe30de5977b1d04e881..811679dd2a95f7c9478e0f560b72ef25c61dbc08 100644 (file)
@@ -132,6 +132,8 @@ static int pxe_parse(struct discover_context *dc)
                if (!pxe_conf_files)
                        goto out_conf;
 
                if (!pxe_conf_files)
                        goto out_conf;
 
+               rc = -1;
+
                for (filename = pxe_conf_files; *filename; filename++) {
                        url = pb_url_join(dc, conf_url, *filename);
                        if (!url)
                for (filename = pxe_conf_files; *filename; filename++) {
                        url = pb_url_join(dc, conf_url, *filename);
                        if (!url)