[PATCH 4/6] kexec: Fix uninitialized build warning

Geoff Levand geoff at infradead.org
Thu Oct 3 16:19:20 EDT 2013


Initialize a local variable to zero.

Fixes build warnings like these:

  kexec/kexec-elf-rel.c: warning: ‘rel.r_offset’ may be used uninitialized in this function

Signed-off-by: Geoff Levand <geoff at infradead.org> for Huawei, Linaro
---
 kexec/kexec-elf-rel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec/kexec-elf-rel.c b/kexec/kexec-elf-rel.c
index f59140f..020cab0 100644
--- a/kexec/kexec-elf-rel.c
+++ b/kexec/kexec-elf-rel.c
@@ -336,7 +336,7 @@ int elf_rel_load(struct mem_ehdr *ehdr, struct kexec_info *info,
 		}
 		rel_end = shdr->sh_data + shdr->sh_size;
 		for(ptr = shdr->sh_data; ptr < rel_end; ptr += rel_size) {
-			struct mem_rela rel;
+			struct mem_rela rel = {0};
 			struct mem_sym sym;
 			const void *location;
 			const unsigned char *name;
-- 
1.8.1.2





More information about the kexec mailing list