[PATCH 3.17-rc5 ] scripts/sortextable: Suppress warning: ârelocs_sizeâ may be used uninitialized

From: tim . gardner
Date: Tue Sep 16 2014 - 14:50:08 EST


From: Tim Gardner <tim.gardner@xxxxxxxxxxxxx>

In file included from scripts/sortextable.c:194:0:
scripts/sortextable.c: In function âmainâ:
scripts/sortextable.h:176:3: warning: ârelocs_sizeâ may be used uninitialized in this function [-Wmaybe-uninitialized]
memset(relocs, 0, relocs_size);
^
scripts/sortextable.h:106:6: note: ârelocs_sizeâ was declared here
int relocs_size;
^
In file included from scripts/sortextable.c:192:0:
scripts/sortextable.h:176:3: warning: ârelocs_sizeâ may be used uninitialized in this function [-Wmaybe-uninitialized]
memset(relocs, 0, relocs_size);
^
scripts/sortextable.h:106:6: note: ârelocs_sizeâ was declared here
int relocs_size;
^

gcc 4.9.1

Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Jamie Iles <jamie.iles@xxxxxxxxxx>
Signed-off-by: Tim Gardner <tim.gardner@xxxxxxxxxxxxx>
---

Is gcc 4.9 dumber then 4.8 ? gcc 4.8 doesn't produce this warning.

scripts/sortextable.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/sortextable.h b/scripts/sortextable.h
index 8fac3fd..ba87004 100644
--- a/scripts/sortextable.h
+++ b/scripts/sortextable.h
@@ -103,7 +103,7 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort)
Elf_Sym *sort_needed_sym;
Elf_Shdr *sort_needed_sec;
Elf_Rel *relocs = NULL;
- int relocs_size;
+ int relocs_size = 0;
uint32_t *sort_done_location;
const char *secstrtab;
const char *strtab;
--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/