public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hexdump: initialize hex->skip
@ 2013-12-27 13:44 Andrey Vagin
  2014-01-06 12:56 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Vagin @ 2013-12-27 13:44 UTC (permalink / raw)
  To: util-linux; +Cc: Karel Zak, Andrew Vagin

From: Andrew Vagin <avagin@openvz.org>

==11097== Conditional jump or move depends on uninitialised value(s)
==11097==    at 0x9588: next (hexdump-display.c:355)
==11097==    by 0x9767: display (hexdump-display.c:280)
==11097==    by 0x9227: main (hexdump.c:198)

Signed-off-by: Andrew Vagin <avagin@openvz.org>
---
 text-utils/hexdump.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/text-utils/hexdump.c b/text-utils/hexdump.c
index e9fca02..1806077 100644
--- a/text-utils/hexdump.c
+++ b/text-utils/hexdump.c
@@ -169,6 +169,7 @@ int main(int argc, char **argv)
 
 	struct hexdump *hex = malloc (sizeof (struct hexdump));
 	hex->length = -1;
+	hex->skip = 0;
 	INIT_LIST_HEAD(&hex->fshead);
 
 	setlocale(LC_ALL, "");
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hexdump: initialize hex->skip
  2013-12-27 13:44 [PATCH] hexdump: initialize hex->skip Andrey Vagin
@ 2014-01-06 12:56 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2014-01-06 12:56 UTC (permalink / raw)
  To: Andrey Vagin; +Cc: util-linux

On Fri, Dec 27, 2013 at 05:44:48PM +0400, Andrey Vagin wrote:
>  	struct hexdump *hex = malloc (sizeof (struct hexdump));
>  	hex->length = -1;
> +	hex->skip = 0;
>  	INIT_LIST_HEAD(&hex->fshead);

 Fixed. It seems better to call calloc() rather then set all the
 fields to zero.

    Karel 

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-06 12:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-27 13:44 [PATCH] hexdump: initialize hex->skip Andrey Vagin
2014-01-06 12:56 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox