Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp2061797lfo; Fri, 20 May 2022 11:57:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycFYBdt+5BSqAa2B6dmHjuI5FFfkEVJgEFGgvsgRwq7lGdcE/+z7xTR0dolOqiHKnXoSxB X-Received: by 2002:a17:907:3e93:b0:6f4:e215:e293 with SMTP id hs19-20020a1709073e9300b006f4e215e293mr9955389ejc.629.1653073031720; Fri, 20 May 2022 11:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653073031; cv=none; d=google.com; s=arc-20160816; b=eWZUmIYxYZIPvffvKi8WPRkv5UTUBSztYiVQmzrw9mg6Q4bQTZaILxIdLCmN7P0m85 l4mLmRIN8rDrsp8RkXJGStvIgqwbBuAQRuHKsuqNClAdJ/WJeZEOUX4dq8LPTImzRllL UxmEw5y0eWABsL/o2pBLRDyKeLyqF10XSEc1yM9pAQ9MT/yBe5UiuT464kC+bO4xUFvR f68+MFbMjdczCjzjvyYNYGkpvn2zFCZQs+8TRMf/Xivyhnz1hqhbb5Qc7OvMO6XclqJL Q1Kt+WKTHlJwKBiISaY8LCGLcHfsn7jpn+eilwDz2K+HS1wrmKozsPqXfg5HsWmrrue9 fJ+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=RA+gGY8dLwh8y/CQ41vF54pvIQyZE8P1Ve2JTxLWqzk=; b=XUrSnMwTlX9F4Zg3C+3ZSkFzFVv+3nsOOyhIZPMVcwQNS6/wtYHWEkuDR2T/+kdU6G FA8OEZbwOrAtF7pLcMkUfrQTaZQ7zOAj9z+niQCEnemopFcgS0MPPfEdXYioVOqIhg1z 1yz+FdztDdv7P/m6LO4LHMjhwQcd3Luly0GA35blN48sPIQYLG402pw9UtK1tolKGJgi VvEia6UH+qMKXijJZpk5gI3FZlCblXOYIOc333Dy/CHHjuaWGpSNP6dsVu5E5cvZO4re I8eT2gPse3HpTZTYiT64y+GlHav/z681NC/asaMSS03D74/IbiMib36fpOVt7I43rgHe j7/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=komyDIKL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp25-20020a1709071b1900b006f4408bfffbsi705446ejc.779.2022.05.20.11.56.46; Fri, 20 May 2022 11:57:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=komyDIKL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245186AbiESVpS (ORCPT + 99 others); Thu, 19 May 2022 17:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229862AbiESVpQ (ORCPT ); Thu, 19 May 2022 17:45:16 -0400 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11E8C5A2C5; Thu, 19 May 2022 14:45:16 -0700 (PDT) Received: by mail-oi1-x22c.google.com with SMTP id e189so8002819oia.8; Thu, 19 May 2022 14:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=RA+gGY8dLwh8y/CQ41vF54pvIQyZE8P1Ve2JTxLWqzk=; b=komyDIKLLcEAdb2S/E9vT7gRCg4awOj6VLLeL5gQz8pAou0tQ1fmjMobOtMNbtLMXk OiPUvli6Fz2kBCdflelS0IawhAO52s2Vgkmkhzssms83DVJr8UiaGzlk/8DO3li8IRwc 7wffbBK6V1XjkevgKLnh53ZdTlMHq2HkWqDn9hGhAPKefmdOl3FEVXVFXuK05lRSaI2f nFwwO+WzrqUSDMHltYMMVuScxwKdNFXH9LaQON3dgyyuL9i0poQSNdaSKiPtXBv7tdxC ScKoz60Vbvx7mN3RKACj+Ud4X1CwO5lKtgodCl3SlP8an5L/Gpw5HtMF6Cx6f0OLojJN TYdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RA+gGY8dLwh8y/CQ41vF54pvIQyZE8P1Ve2JTxLWqzk=; b=Hg42z2zwZTkfOFGq+fpWa+/JTxcwsxobGiEOLqW2cXFMxadkjhAm6gjpVbxpDMxfzE z8/dAF4SVc51ovHubxqJ/WwqUJv/calzTQ0slccBZZ6GPITMVRKBnow8f1vsMVdsB66h 5Ot9C4az50DTUM8PcFtQCgSDEVyx3+0U0FI0hIBrpfs+UaZfEc70RU/4XvIbaRWGxCx3 TFOMyQesb+5d1ZqL5BoIjAbHx1J7SnL+HMb31KP2H7EpZEGfckFmg3fN3/prKw+6Xcaz XCZh5o0Od/3iM6FrbufK+qvlBHEUHUaMkMmu4zE+t0GOzm9nhoFYk2XTu9xGjgDKJlt7 1QfA== X-Gm-Message-State: AOAM5308CwwMqZCL5wycAeMggzqjnns++AfLFbjcPk6GAbL8X+VGgALZ gReQZpuH9dmr6PZblqhy8WVmntLRZQDbhgfeYnM= X-Received: by 2002:a05:6808:2218:b0:326:bd8c:d044 with SMTP id bd24-20020a056808221800b00326bd8cd044mr3689489oib.92.1652996715409; Thu, 19 May 2022 14:45:15 -0700 (PDT) MIME-Version: 1.0 References: <20220519085530.999726-1-tmricht@linux.ibm.com> In-Reply-To: <20220519085530.999726-1-tmricht@linux.ibm.com> From: Namhyung Kim Date: Thu, 19 May 2022 14:45:04 -0700 Message-ID: Subject: Re: [PATCH] perf/s390: Compiler error on s390 for bench/numa.c To: Thomas Richter Cc: linux-kernel , linux-perf-users , Arnaldo Carvalho de Melo , Sven Schnelle , gor@linux.ibm.com, sumanthk@linux.ibm.com, Heiko Carstens Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 19, 2022 at 9:27 AM Thomas Richter wrot= e: > > The compilation on s390 results in this error: > > # make DEBUG=3Dy bench/numa.o > ... > bench/numa.c: In function =E2=80=98__bench_numa=E2=80=99: > bench/numa.c:1749:81: error: =E2=80=98%d=E2=80=99 directive output may b= e truncated > writing between 1 and 11 bytes into a region of size between > 10 and 20 [-Werror=3Dformat-truncation=3D] > 1749 | snprintf(tname, sizeof(tname), "process%d:thread%d", p, t)= ; > ^~ > ... > bench/numa.c:1749:64: note: directive argument in the range > [-2147483647, 2147483646] > ... > # > > The maximum length of the %d replacement is 11 characters because > of the negative sign. Therefore use %u as format conversion. But their type is int and I'm afraid some compilers might complain about it. Why not just increase the buffer size? Thanks, Namhyung > > Output after: > # make DEBUG=3Dy bench/numa.o > /dev/null 2>&1; ll bench/numa.o > -rw-r--r-- 1 root root 418320 May 19 09:11 bench/numa.o > # > > Signed-off-by: Thomas Richter > --- > tools/perf/bench/numa.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c > index d5289fa58a4f..ff0bfd87afbb 100644 > --- a/tools/perf/bench/numa.c > +++ b/tools/perf/bench/numa.c > @@ -1746,7 +1746,7 @@ static int __bench_numa(const char *name) > for (t =3D 0; t < g->p.nr_threads; t++) { > memset(tname, 0, sizeof(tname)); > td =3D g->threads + p*g->p.nr_threads + t= ; > - snprintf(tname, sizeof(tname), "process%d= :thread%d", p, t); > + snprintf(tname, sizeof(tname), "process%u= :thread%u", p, t); > print_res(tname, td->speed_gbs, > "GB/sec", "thread-speed", "= GB/sec/thread speed"); > print_res(tname, td->system_time_ns / NSE= C_PER_SEC, > -- > 2.36.1 >