mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tim.gardner@canonical.com
To: linux-kernel@vger.kernel.org
Cc: Tim Gardner <tim.gardner@canonical.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jamie Iles <jamie.iles@oracle.com>
Subject: [PATCH 3.17-rc5 ] scripts/sortextable: Suppress warning: ‘relocs_size’ may be used uninitialized
Date: Tue, 16 Sep 2014 12:49:22 -0600	[thread overview]
Message-ID: <1410893362-17128-1-git-send-email-tim.gardner@canonical.com> (raw)

From: Tim Gardner <tim.gardner@canonical.com>

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@linux-foundation.org>
Cc: Jamie Iles <jamie.iles@oracle.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---

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


             reply	other threads:[~2014-09-16 18:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16 18:49 tim.gardner [this message]
2014-09-18  8:20 ` Jamie Iles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410893362-17128-1-git-send-email-tim.gardner@canonical.com \
    --to=tim.gardner@canonical.com \
    --cc=akpm@linux-foundation.org \
    --cc=jamie.iles@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®