From patchwork Wed Aug 29 12:17:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Motai.Hirotaka@aj.MitsubishiElectric.co.jp" X-Patchwork-Id: 10580193 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2132F174A for ; Wed, 29 Aug 2018 12:40:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F66D2AFFD for ; Wed, 29 Aug 2018 12:40:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 037AC2B004; Wed, 29 Aug 2018 12:40:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF5C32AFFD for ; Wed, 29 Aug 2018 12:40:30 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 2C07DD48; Wed, 29 Aug 2018 12:36:45 +0000 (UTC) X-Original-To: ltsi-dev@lists.linuxfoundation.org Delivered-To: ltsi-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id EEEAAD19 for ; Wed, 29 Aug 2018 12:36:40 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx04.melco.co.jp (mx04.melco.co.jp [192.218.140.144]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 842EC7CB for ; Wed, 29 Aug 2018 12:36:38 +0000 (UTC) Received: from mr04.melco.co.jp (mr04 [133.141.98.166]) by mx04.melco.co.jp (Postfix) with ESMTP id CAB683A32BC for ; Wed, 29 Aug 2018 21:18:09 +0900 (JST) Received: from mr04.melco.co.jp (unknown [127.0.0.1]) by mr04.imss (Postfix) with ESMTP id 420l5F5XrbzRk8j for ; Wed, 29 Aug 2018 21:18:09 +0900 (JST) Received: from mf04_second.melco.co.jp (unknown [192.168.20.184]) by mr04.melco.co.jp (Postfix) with ESMTP id 420l5F5F6rzRjwX for ; Wed, 29 Aug 2018 21:18:09 +0900 (JST) Received: from mf04.melco.co.jp (unknown [133.141.98.184]) by mf04_second.melco.co.jp (Postfix) with ESMTP id 420l5F5CVvzRkCw for ; Wed, 29 Aug 2018 21:18:09 +0900 (JST) Received: from JPN01-TY1-obe.outbound.protection.outlook.com (unknown [23.103.139.179]) by mf04.melco.co.jp (Postfix) with ESMTP id 420l5F52XpzRkCn for ; Wed, 29 Aug 2018 21:18:09 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mitsubishielectricgroup.onmicrosoft.com; s=selector1-mitsubishielectricgroup-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cPZVPAutCjfmM1AB0baVD1ipxg+RGD2V/z9ZvnPngk4=; b=pm26vmFBcUrOWqNTLvks/LFTCLx9/wchfvbZzpsROsp7a79Cumx0znfJ/kxk7Y1aAATsHWt4r7stOs8gAvsmnrxQgVTX2EjQot9U8HQumXNRGIBGOfBpm0ysvguQMNgfFRqSGFFwbG39lyDfXExsWUUs5/ct/QsZYBeTfYm4BJM= Received: from TY1PR01MB1692.jpnprd01.prod.outlook.com (52.133.160.145) by TY1PR01MB0841.jpnprd01.prod.outlook.com (10.167.159.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.15; Wed, 29 Aug 2018 12:18:09 +0000 Received: from TY1PR01MB1692.jpnprd01.prod.outlook.com ([fe80::d04e:e6f6:c782:22fa]) by TY1PR01MB1692.jpnprd01.prod.outlook.com ([fe80::d04e:e6f6:c782:22fa%2]) with mapi id 15.20.1080.015; Wed, 29 Aug 2018 12:18:09 +0000 From: "Motai.Hirotaka@aj.MitsubishiElectric.co.jp" To: "ltsi-dev@lists.linuxfoundation.org" Thread-Topic: [LTSI-dev] [PATCH 48/54] tracing: Uninitialized variable in create_tracing_map_fields() Thread-Index: AdQ/jRUpcwhqdfIDSL6flRmr0UK0uA== Date: Wed, 29 Aug 2018 12:17:12 +0000 Deferred-Delivery: Wed, 29 Aug 2018 12:15:00 +0000 Message-ID: Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-melpop: 1 authentication-results: spf=none (sender IP is ) smtp.mailfrom=Motai.Hirotaka@aj.MitsubishiElectric.co.jp; x-originating-ip: [153.231.200.201] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TY1PR01MB0841; 6:TaS+DF0sNmdjzjoQ+hWIKSEV9oyAHVro4OfzbWlwuuNsc2oGmi9hLGsxTWaVGhFhCtjNcXqHp3ScY5M1HJRbgQce01MiXMPmX9Cn4uR/jh7ugMLXzlickWMALpzVeIVkRi2WhAKohjfZs6nZQUu1bwuI4hxinLtOd+cJuAlkVgiIdfk7yyS7SpQegCfalGRJDxz8SlouRa28u1CsUwHUEW/R7jNja8R+xBDX3UZMvy1SS7zvS1zEXkGzeDmbYH8CndoT/y2hlVlQ8guAkRuEn1ZMe5EggDt1uKLvAKON9usIMIADecTq2yqzIaZgJ1aQgpWuHcrN5XRMBPRFdg4ny7pkt1V3HtoxBGSNbomJuhuwqsDGcrsiQM/T0w382Xl1CIn3vrR7LvyDCzWun+nIfIx82uSHTkOLelgcFMvmtxGzc7PYzpvjab6G4SY92tlOaCYewM3IIDHKiE2CJ89stQ==; 5:xvIcAuxXtpl0e4WXRy8XzysLzEm+zJuB5iMTyC2ak2Q1rdPHRwxEN3zUd3czEyDN0QTfHFYoTn7NO49NI4AC/jkraf5+XWbzwGUQl9PYhHf374EIP6ykoSZemSCvYEOw4xggHgwL8YC3Gemxh5s/H6Ec/qi4dNJ591WZC9B/U+4=; 7:6n3453v/2KlI7ONfOCneF1jNnzgvU1doCzxCMktc0KFVU6ivqi+7qiqaEVXniHvnkii3BcZbdqqx+03OMyWliccvNsqwaECu2xB440ee0nb9U7RURDkD19iWh7CyOMDt1KBEd9RTxXQT5pvwTDx8nMcu/P6ITd6F/TPef4vmLd5D8OZQwsiFrkHsEFPFcqBgbVOw4Tgis2HiSFCbIYaPRKJEDmzrJSmTgMnNLFdo8F80ZqbQdI9jwkO4cVGLeMcN x-ms-office365-filtering-correlation-id: 19c6aa7a-4605-4445-6c64-08d60da97b6e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:TY1PR01MB0841; x-ms-traffictypediagnostic: TY1PR01MB0841: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(42068640409301)(146099531331640)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016); SRVR:TY1PR01MB0841; BCL:0; PCL:0; RULEID:; SRVR:TY1PR01MB0841; x-forefront-prvs: 077929D941 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39850400004)(136003)(346002)(396003)(366004)(376002)(199004)(189003)(2906002)(68736007)(2501003)(97736004)(72206003)(6666003)(966005)(2351001)(478600001)(25786009)(66066001)(2900100001)(8676002)(5250100002)(81156014)(74316002)(305945005)(7736002)(81166006)(6306002)(53936002)(33656002)(9686003)(6116002)(6436002)(5640700003)(55016002)(6916009)(105586002)(86362001)(99286004)(575784001)(74482002)(3846002)(7696005)(316002)(6506007)(102836004)(106356001)(186003)(1857600001)(26005)(256004)(14444005)(486006)(14454004)(8936002)(5660300001)(476003); DIR:OUT; SFP:1102; SCL:1; SRVR:TY1PR01MB0841; H:TY1PR01MB1692.jpnprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:0; MX:1; received-spf: None (protection.outlook.com: aj.MitsubishiElectric.co.jp does not designate permitted sender hosts) x-microsoft-antispam-message-info: A5+bvvYTQa6pixh/0CZ72EM925xEA8++E7xormTO8Dd5X0sdk+/RU5tJjOJ4DzbUuL0E2KmE43MIumaFjWp3enCdvl4899u9HlWWc9c352cIRFnjoOmGsNUUZr3GR2L6TYdD1Ao/ZyEzDdohmtrXKMCtDE9rOBBVq5pR4KnYquP0ZO878IDJyKZpKetqZJRdm1CfVFKEdfRVeVLr0cQpQhUJlZ5njECakpZh1XLc/vuu3mMKk3ERvDqQ2FKSNv6iU5WXZa99D1HAaIiAqEXxJXD1P/HSogX4jnNf0p1C1OasOlx8CCsV+D5vyGyrVC+iVI1DRDxPFy3qgZuAb9kc5J+7JpSkZ3S+FD0O70I/V68= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: aj.MitsubishiElectric.co.jp X-MS-Exchange-CrossTenant-Network-Message-Id: 19c6aa7a-4605-4445-6c64-08d60da97b6e X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2018 12:17:22.6497 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c5a75b62-4bff-4c96-a720-6621ce9978e5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY1PR01MB0841 Subject: [LTSI-dev] [PATCH 48/54] tracing: Uninitialized variable in create_tracing_map_fields() X-BeenThere: ltsi-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "A list to discuss patches, development, and other things related to the LTSI project" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ltsi-dev-bounces@lists.linuxfoundation.org Errors-To: ltsi-dev-bounces@lists.linuxfoundation.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Link: http://lkml.kernel.org/r/20180328114815.GC29050@mwanda Fixes: 30350d65ac56 ("tracing: Add variable support to hist triggers") Acked-by: Tom Zanussi Signed-off-by: Dan Carpenter Signed-off-by: Steven Rostedt (VMware) (cherry picked from commit b28d7b2dc27f0eef1ae608b49d6860f2463910f1) Signed-off-by: Hirotaka MOTAI --- kernel/trace/trace_events_hist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 15ea11c2..0d7b3ffb 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -4453,17 +4453,17 @@ static void destroy_hist_data(struct hist_trigger_data *hist_data) kfree(hist_data); } 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]; if (hist_field->flags & HIST_FIELD_FL_KEY) { tracing_map_cmp_fn_t cmp_fn; field = hist_field->field;