Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162119AbdDWKeK (ORCPT ); Sun, 23 Apr 2017 06:34:10 -0400 Received: from mx.kolabnow.com ([95.128.36.1]:36696 "EHLO mx-out03.mykolab.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1044918AbdDWKdV (ORCPT ); Sun, 23 Apr 2017 06:33:21 -0400 X-Spam-Flag: NO X-Spam-Score: -2.9 From: Federico Vaga To: Steven Rostedt Cc: LKML , Federico Vaga Subject: [PATCH 3/5] trace-cmd:read: BUG initialize input_files item to zero Date: Sun, 23 Apr 2017 12:22:56 +0200 Message-Id: <20170423102258.21609-4-federico.vaga@vaga.pv.it> In-Reply-To: <20170423102258.21609-1-federico.vaga@vaga.pv.it> References: <20170423102258.21609-1-federico.vaga@vaga.pv.it> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 695 Lines: 23 On allocation the data structure was not initialized. Later on some attribute of this structure are used (e.g. tsoffset) assuming that the default value is zero, but it is not always true. Signed-off-by: Federico Vaga --- trace-read.c | 1 + 1 file changed, 1 insertion(+) diff --git a/trace-read.c b/trace-read.c index 79519bd..9773a47 100644 --- a/trace-read.c +++ b/trace-read.c @@ -295,6 +295,7 @@ static void add_input(const char *file) item = malloc(sizeof(*item)); if (!item) die("Failed to allocate for %s", file); + memset(item, 0, sizeof(*item)); item->file = file; list_add_tail(&item->list, &input_files); last_input_file = item; -- 2.9.3