[Crosstoolchain-logs] [device-tree-compiler] 38/58: libfdt: overlay: Check the value of the right variable

Vagrant Cascadian vagrant at moszumanska.debian.org
Mon Sep 25 16:23:48 UTC 2017


This is an automated email from the git hooks/post-receive script.

vagrant pushed a commit to branch debian/master
in repository device-tree-compiler.

commit 921cc17fec295ce46720437cb064d0a6abf298e1
Author: Nicolas Iooss <nicolas.iooss_linux at m4x.org>
Date:   Sat Mar 4 14:26:44 2017 +0100

    libfdt: overlay: Check the value of the right variable
    
    overlay_update_local_node_references() saves the result of
    fdt_subnode_offset() into variable tree_child but checks for variable
    ret afterwards. As this does not make sense, check tree_child instead of
    ret.
    
    This bug has been found by compiling with clang. The compiler reported
    the following warning:
    
        libfdt/fdt_overlay.c:275:7: error: variable 'ret' may be
        uninitialized when used here
              [-Werror,-Wconditional-uninitialized]
                        if (ret == -FDT_ERR_NOTFOUND)
                            ^~~
        libfdt/fdt_overlay.c:210:9: note: initialize the variable 'ret' to
        silence this
              warning
                int ret;
                       ^
                        = 0
    
    Signed-off-by: Nicolas Iooss <nicolas.iooss_linux at m4x.org>
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 libfdt/fdt_overlay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libfdt/fdt_overlay.c b/libfdt/fdt_overlay.c
index 9d03221..ceb9687 100644
--- a/libfdt/fdt_overlay.c
+++ b/libfdt/fdt_overlay.c
@@ -271,7 +271,7 @@ static int overlay_update_local_node_references(void *fdto,
 
 		tree_child = fdt_subnode_offset(fdto, tree_node,
 						fixup_child_name);
-		if (ret == -FDT_ERR_NOTFOUND)
+		if (tree_child == -FDT_ERR_NOTFOUND)
 			return -FDT_ERR_BADOVERLAY;
 		if (tree_child < 0)
 			return tree_child;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list