Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp819987imu; Fri, 11 Jan 2019 09:35:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN6SetjjLdRuTDv5edysmLM8R/7UD17pyOPyXuteFNVM65WxyN7tignkQRznz+Himx087qbF X-Received: by 2002:a17:902:5a0b:: with SMTP id q11mr15661522pli.186.1547228112899; Fri, 11 Jan 2019 09:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547228112; cv=none; d=google.com; s=arc-20160816; b=smtaa9cXvXGe7vSplKEuR2PQebhUixgDn3l+0AMTDnsqpiqRjSXBgIwuqnDw0PADe1 bjZquEtMlV4IbyQV9tNJryHtSUS3tiQ5g3dO3tOiZ2mwv/hY4jJfaH2ESxGrTUE+8Nbe RYOaRYxtPfQOzplZ90g7wTjyKESj2kCvuTME1NxI3kWg1iSXfiH1jubR4lyED4+Qsx9v GoSm7uRFaZlhHteqU9inZr4X8x/pcrhPoGJxO8jvw1+0J4m7XrV34ykHmCU8faVTmR0W XqZQpLtH95R2yA7HKiQ1pWgiPmGhjHprTLYzG10VTymYXLBeyCfe4cwVTRhPUXxzGtL9 QN0g== 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=juM1J914jbHl3I1W2HXORYsfx11+LkcRY3IYU6HnhK0=; b=p/+u20NzlDrse0Lsaik/TDoh/Vtdecu7Foob80AnGoV7R6dKwqpFbTc7nhKadX19J7 bJt4n/3JllYdOthFBpsqguPGD0hcRtsc/zXh2ty7EbhDsJKZvDrTjEnjzi09Cs2H8Ih7 tHYzCiWv/ZvmeeXSKc3Os/aY72a0H7mxmgmyJuq933C37BSBMuIyQStyzOF6YOkHO72h Y/i7nMyL16RLrCZx1XG19VUoDxKGA7Jxv3+RpQXAYV4hAosCwZd8Tk/geArKINxmr1HM WtbNf9pr7VpC2P+SsHBUac8pge377ikGuxYEqRX+en1ZZx+kFQ+NwkGC1MspxBW8HTGK loDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wyLBy0iX; 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 g184si6095116pfb.288.2019.01.11.09.34.57; Fri, 11 Jan 2019 09:35:12 -0800 (PST) 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=wyLBy0iX; 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 S2387952AbfAKOSF (ORCPT + 99 others); Fri, 11 Jan 2019 09:18:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:34474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729489AbfAKOSE (ORCPT ); Fri, 11 Jan 2019 09:18:04 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 6862021783; Fri, 11 Jan 2019 14:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547216282; bh=jnVegdIbp9FIb7dbjbp4gtO4/ZO+19X86yKJrjnL0R0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wyLBy0iXnuLjVh2Bt/Wq/kV8zNRW+0w9rINxmo3uRm5dLFUVgDkbCtWqK95+WYuBX TUjq+3Y8TTUm74XBtIBm7QJ7Jdv0zUkUPHAiKZGEFIAS45TczDJA14VUuTQ/5+MaDv /YfUQl5Bu6iw6dG82vwoKIHWuJPuhxYS/NB1sFZk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Hutchings , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 4.4 41/88] perf pmu: Suppress potential format-truncation warning Date: Fri, 11 Jan 2019 15:08:10 +0100 Message-Id: <20190111131051.981733777@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190111131045.137499039@linuxfoundation.org> References: <20190111131045.137499039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ben Hutchings commit 11a64a05dc649815670b1be9fe63d205cb076401 upstream. Depending on which functions are inlined in util/pmu.c, the snprintf() calls in perf_pmu__parse_{scale,unit,per_pkg,snapshot}() might trigger a warning: util/pmu.c: In function 'pmu_aliases': util/pmu.c:178:31: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-truncation=] snprintf(path, PATH_MAX, "%s/%s.unit", dir, name); ^~ I found this when trying to build perf from Linux 3.16 with gcc 8. However I can reproduce the problem in mainline if I force __perf_pmu__new_alias() to be inlined. Suppress this by using scnprintf() as has been done elsewhere in perf. Signed-off-by: Ben Hutchings Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/20181111184524.fux4taownc6ndbx6@decadent.org.uk Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/pmu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -100,7 +100,7 @@ static int perf_pmu__parse_scale(struct char path[PATH_MAX]; const char *lc; - snprintf(path, PATH_MAX, "%s/%s.scale", dir, name); + scnprintf(path, PATH_MAX, "%s/%s.scale", dir, name); fd = open(path, O_RDONLY); if (fd == -1) @@ -147,7 +147,7 @@ static int perf_pmu__parse_unit(struct p ssize_t sret; int fd; - snprintf(path, PATH_MAX, "%s/%s.unit", dir, name); + scnprintf(path, PATH_MAX, "%s/%s.unit", dir, name); fd = open(path, O_RDONLY); if (fd == -1) @@ -177,7 +177,7 @@ perf_pmu__parse_per_pkg(struct perf_pmu_ char path[PATH_MAX]; int fd; - snprintf(path, PATH_MAX, "%s/%s.per-pkg", dir, name); + scnprintf(path, PATH_MAX, "%s/%s.per-pkg", dir, name); fd = open(path, O_RDONLY); if (fd == -1) @@ -195,7 +195,7 @@ static int perf_pmu__parse_snapshot(stru char path[PATH_MAX]; int fd; - snprintf(path, PATH_MAX, "%s/%s.snapshot", dir, name); + scnprintf(path, PATH_MAX, "%s/%s.snapshot", dir, name); fd = open(path, O_RDONLY); if (fd == -1)