Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1341903ybp; Thu, 17 Oct 2019 11:19:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZ2d+Pn5rQjSFuhrZ8BplRZyzXNBrAIsDWktMo+ZHT0rWbWYPHCIyUUM4QnoPXTEBHml6B X-Received: by 2002:a17:906:745:: with SMTP id z5mr4952819ejb.41.1571336365496; Thu, 17 Oct 2019 11:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571336365; cv=none; d=google.com; s=arc-20160816; b=XStLbA7FDKA0KQ4R1dqGLXZm9//R1/2Wnq0kVS+fVSha6m5PMmz0EQrGG3Y7hSPFP0 TnTaoBPrSHwLpOpMz/2CP4FUUVrhAKw6fmb/OEBP2sd8dlV/vItTRzQK//AmOGSZYFtx cmEgkqg0T5ntt5+aTnGGS0irC4Rq7MXaUavZ9c2xiC9+ZI1/9hwYqe5lGdw/4dZ6SR8j 4dQD/2blaY2Mc7Gj41ZbYpBUFu5CmUa1DCQvNXsM5ZS2ZkjSQCmOKrSGtF52/rZ0PHtI qx9JXlWLIx5vO7WvVT+QC3paCfCziywBqBRUMfsEANi3A1KxhMf3C7xKI7WHdrx0HrWe nyjA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6I1FRUia/sj3Mt0tUGagHwx/QI9iEtwd7GVHtEGoAzw=; b=bd4Lk/ATPQW8acw15UIPyvYOLebJ5gCmx3wI/auWUHRjXp+VNH2b8AuuDnvam5BSEc s6/RI/hgaPVlk358CP5nROCg5PqSYosNqTy8mKTcLly6yLC7QkSi0MjAajXOo46FtErY FVW/ShV+ChBT+BnMS25ty2uuEkv9rvC9Xg/mKZ+tWx44ZgsLntQ9ddVcDVIF9RoeR4ef XrO8kHIbPzwqYcjaPoXb1DhTxCmdtIJ9KZb5G3cZa+33LkEUpV/7Cp2S4z5IWgMgLKYM TPC2c6ORf3RUGf7ElrkZuEtSxuknlIsCB1jixErdXKH23ob8Lb5SPu+/adxkVRPUKUnO JB3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JLEy2D7L; 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 f7si1778465ejt.155.2019.10.17.11.19.02; Thu, 17 Oct 2019 11:19:25 -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; dkim=pass header.i=@kernel.org header.s=default header.b=JLEy2D7L; 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 S2438699AbfJPWAH (ORCPT + 99 others); Wed, 16 Oct 2019 18:00:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:53280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438368AbfJPV7C (ORCPT ); Wed, 16 Oct 2019 17:59:02 -0400 Received: from localhost (unknown [192.55.54.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 29851222BD; Wed, 16 Oct 2019 21:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263142; bh=NA5sy7uLif2TDblpX2/ruEnix2VOEuhXrq7hRlnEMZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JLEy2D7LoU9ekO/vBc55EnfUqpZ/HtE9xxBm4ao01Bai1sEg6Sq3+aQHNBFzlWuD7 MQTYhVeqdbIQ575mTzr//IU7YjyhYrZGOWUUfvXe56WOuJT+VDJFreG86ITtkYg+0H QHp15a3K96tioWz8+zOH62u4bbAx5DtxjjWyFx1M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Alexander Shishkin , Andi Kleen , Jiri Olsa , Namhyung Kim , Peter Zijlstra , Stephane Eranian , Wang Nan , Arnaldo Carvalho de Melo Subject: [PATCH 5.3 066/112] perf llvm: Dont access out-of-scope array Date: Wed, 16 Oct 2019 14:50:58 -0700 Message-Id: <20191016214902.131334634@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214844.038848564@linuxfoundation.org> References: <20191016214844.038848564@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ian Rogers commit 7d4c85b7035eb2f9ab217ce649dcd1bfaf0cacd3 upstream. The 'test_dir' variable is assigned to the 'release' array which is out-of-scope 3 lines later. Extend the scope of the 'release' array so that an out-of-scope array isn't accessed. Bug detected by clang's address sanitizer. Fixes: 07bc5c699a3d ("perf tools: Make fetch_kernel_version() publicly available") Cc: stable@vger.kernel.org # v4.4+ Signed-off-by: Ian Rogers Cc: Alexander Shishkin Cc: Andi Kleen Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Wang Nan Link: http://lore.kernel.org/lkml/20190926220018.25402-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/llvm-utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/tools/perf/util/llvm-utils.c +++ b/tools/perf/util/llvm-utils.c @@ -231,14 +231,14 @@ static int detect_kbuild_dir(char **kbui const char *prefix_dir = ""; const char *suffix_dir = ""; + /* _UTSNAME_LENGTH is 65 */ + char release[128]; + char *autoconf_path; int err; if (!test_dir) { - /* _UTSNAME_LENGTH is 65 */ - char release[128]; - err = fetch_kernel_version(NULL, release, sizeof(release)); if (err)