Received: by 10.213.65.68 with SMTP id h4csp472070imn; Wed, 28 Mar 2018 07:07:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Iy6SXJ5w1oXuBFQnHnhtGGKCqwK0n7LG3toN7ekaZ97Woo42fgD0I9QEDnYjBt5To36M7 X-Received: by 2002:a17:902:b786:: with SMTP id e6-v6mr4093850pls.58.1522246020396; Wed, 28 Mar 2018 07:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522246020; cv=none; d=google.com; s=arc-20160816; b=Z315axfyCtxCwZDnTV2fQVFsWDoWKPGAihGXmGd+QBUhPqzwUy8PZeTtrcOCaAxuiW TRX1/paIs5crhaLTV7MD+v8/NFCNq3/rCtdGHCXwTnZwM43rbqbh+qhfiELFMhqo7wZN y2RUp3oMYbekJTi7tNqzUC6qLQ5vkrBA6MwZTcmKC/hVTlUB50RxZOEOVaQxrtl8CYMn Nmv33xbn9BUoFWrr86mWwph/6JHiHJoCxnnXmIn/1h3JpcoyRrXdc446dUcY8tbRb93i dWJU+VQlA/nkN7jnfqOi3VLeORBdC+XEKPelnBCm9PVhRvcAVZQl+iIm/eCHK1QQ3FGD GERg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=4rUXiJkgt5tWf9J0AY/z21/FrVgZ+2Yhxv40SfK+gRw=; b=mTmEQiIDKyeZZBSGM5PJajuQUKPATC4JQNWjc3SE3iuIFDKjXnoGBwkSTJgrJQq+e9 YsoGLPxD6/9eoRX2ksiOl7dIQ9+93KVZ08d0g0uJNyROc6frPODg0xq2rG/1EpNQX148 LRoDjnvB/vg0CahKxbesb6sReo+itQ1K96doDoOw2Va71QLBlTBWAl7rz7iiLGQDQCKa thlR66CPXZj3hcPr4XKatbcqWMwKj3FePxUF4opIV3o2cfaeJ17FAhxE3G7HnmaaVcbf wtGGYOj1N0lunc6cm6dFv0zxsq6COsQPwU60MtqY30NGY9bgXoc5THWjgOtMTkig8QPN zjlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8-v6si3867452pln.234.2018.03.28.07.06.17; Wed, 28 Mar 2018 07:07:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753452AbeC1OFB (ORCPT + 99 others); Wed, 28 Mar 2018 10:05:01 -0400 Received: from mga11.intel.com ([192.55.52.93]:36624 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752572AbeC1OFA (ORCPT ); Wed, 28 Mar 2018 10:05:00 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Mar 2018 07:04:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,371,1517904000"; d="scan'208";a="29166235" Received: from tzanussi-mobl.amr.corp.intel.com (HELO [10.252.193.206]) ([10.252.193.206]) by orsmga008.jf.intel.com with ESMTP; 28 Mar 2018 07:04:40 -0700 Message-ID: <1522245880.520.1.camel@tzanussi-mobl.amr.corp.intel.com> Subject: Re: [PATCH] tracing: Uninitialized variable in create_tracing_map_fields() From: Tom Zanussi To: Dan Carpenter Cc: Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Date: Wed, 28 Mar 2018 09:04:40 -0500 In-Reply-To: <20180328114815.GC29050@mwanda> References: <20180328114815.GC29050@mwanda> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dan, On Wed, 2018-03-28 at 14:48 +0300, Dan Carpenter wrote: > Smatch complains that idx can be used uninitialized when we check if > (idx < 0). It has to be the first iteration through the loop and the > HIST_FIELD_FL_STACKTRACE bit has to be clear and the HIST_FIELD_FL_VAR > bit has to be set to reach the bug. > > Fixes: 30350d65ac56 ("tracing: Add variable support to hist triggers") > Signed-off-by: Dan Carpenter > > diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c > index 4f027642ceef..6aceee287d07 100644 > --- a/kernel/trace/trace_events_hist.c > +++ b/kernel/trace/trace_events_hist.c > @@ -4411,7 +4411,7 @@ static int create_tracing_map_fields(struct hist_trigger_data *hist_data) > struct tracing_map *map = hist_data->map; > struct ftrace_event_field *field; > struct hist_field *hist_field; > - int i, idx; > + int i, idx = 0; > > for_each_hist_field(i, hist_data) { > hist_field = hist_data->fields[i]; Yes, this should definitely be initialized to 0, thanks for the patch! Acked-by: Tom Zanussi