From nobody Tue Feb 10 01:18:06 2026 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CC0D22759B for ; Tue, 1 Apr 2025 18:26:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743531964; cv=none; b=RiPixm2TSEZBAYjf8irylq9oxXdGybK1ybemHcKaM0TWDRGLdexEzkfy983C0wRKQkzU5Dri3OzqlIVBlXw6/mWZF5e04C8aBDuzEvVVJhXwKf8kIlGVPTkQAGNbxdf32OCFCOVre9zolziEq5ZCdC7XSxQc8+Elr8jFQJqdd7I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743531964; c=relaxed/simple; bh=JQbIyor9Uz/RtWQr1UUzgydOg4ub7P7LYzitc96vXbA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=TJEw1GQf3dE4ZNRfbU34jwNbnMVU1YfgrWz0dTDSeh0Z3ieaEGGyTitor+yaS9dqLHqrWLsLhwLuRgEDTXyk7j+lyUDsqMHdUMKL7LolwKlwn41WrmsGmYauJ783fvrsvJbpXToeGZ+MERmfmuKTfgvSec1nIazOQDYXPO6oQFY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=heLSvOV2; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="heLSvOV2" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2242ce15cc3so109588735ad.1 for ; Tue, 01 Apr 2025 11:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1743531962; x=1744136762; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=hHULpj+H3oi+FzjQgSQqTpXNSrGg7p6q4GuUxzwm0pE=; b=heLSvOV2uFRFbFQn+CH7BLVCmrh8kbaO2sarssM2znoXIXWCJVNx3V9WTAFYrd4Ew/ zwD75oLSBfid0NxCh0swIiUycA+iCCWdUrGRIjqUmQ0sTSxKq3YQ/O4aBkM+oPRu/CqH lvsyWdDjW1TQJNldbYTfkLlCz7x95jvtT2H/u+s+2S/1o6laDDV4lbuiDdoGDoq86MDv dkuw/e1n6780eD9hLZTnDIKwe989GyBy/hzP6dFw9FiAEAb5txY44mDdoeov9OeXFlGU eJ9MQyhMTDe+SI+L7qH2dFJENefePoVgxTwCI5T3+jXCse+VcswoZwePptn2NBOJNLh1 9JHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743531962; x=1744136762; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hHULpj+H3oi+FzjQgSQqTpXNSrGg7p6q4GuUxzwm0pE=; b=mrDI9mMQ5PtKTP+u9AZsw02f4Uf19xDtsdxYDF28tGTJQtr6144swQOl+ccS/t2zCH /YZFVkX6FIdZIClXv7e3iBxo7Ld1toCJEgeCncw4ojT0q0NkdJfiseh1PEIxLZUQm0U0 4jas7qe7+sIBLGEIDyGSxs4aaY8Z2Pmhmlw9doCwy5an0+Li9vLIPGyVub9phT9XeelL Q1F0wGnao/CSWkZf4cZaODacxqcFCGAygOU05SRcA0jGiPZ7RkcGCPpXFI1Bo6GMipOu 4CCWW5shyBD0Ygqd70IizVYSpP2OKDEhAhDg+nj7nNuQ/MjQ3/xTiEBikCRu05H73CW0 ujpA== X-Forwarded-Encrypted: i=1; AJvYcCV+WXtBoDxs7IAVotNNkmixdSHAU0+AkG++tb257f2mpa3bi4AhFl4NPMWnfUu/B/rW1H+sXh1n1D0w6AM=@vger.kernel.org X-Gm-Message-State: AOJu0Yxejr0EySON/Dy22qOrWyaHAoXIoUs+Wjg9dyMSV4mM3kcDDkN2 qQVPkERLMrUGkJeZ++1nhXom+DSm5bBAqFtnl8BOOCbn8UwqOU0njewcuyZ2dUCf5xrNBbqaonM tARCvjA== X-Google-Smtp-Source: AGHT+IHc1J/tLHnNQAMUxzKYcdtcAYe82KDst9YqDC4pcuDponTRkiDDZZDry2Fvl+/yYJUZ6LaDdz401DxW X-Received: from pjbqo8.prod.google.com ([2002:a17:90b:3dc8:b0:2ff:6e58:89f7]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:ce84:b0:21f:4649:fd49 with SMTP id d9443c01a7336-2292fa0294emr209138475ad.49.1743531961690; Tue, 01 Apr 2025 11:26:01 -0700 (PDT) Date: Tue, 1 Apr 2025 11:23:40 -0700 In-Reply-To: <20250401182347.3422199-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250401182347.3422199-1-irogers@google.com> X-Mailer: git-send-email 2.49.0.504.g3bcea36a83-goog Message-ID: <20250401182347.3422199-43-irogers@google.com> Subject: [PATCH v1 42/48] perf diff: Silence -Wshorten-64-to-32 warnings From: Ian Rogers To: Yury Norov , Rasmus Villemoes , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , Thomas Gleixner , Darren Hart , Davidlohr Bueso , "=?UTF-8?q?Andr=C3=A9=20Almeida?=" , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Yicong Yang , Jonathan Cameron , Nathan Chancellor , Bill Wendling , Justin Stitt , Josh Poimboeuf , Al Viro , Kyle Meyer , Ben Gainey , Athira Rajeev , Kajol Jain , Aditya Gupta , Eder Zulian , Dapeng Mi , Kuan-Wei Chiu , He Zhe , Dirk Gouders , Brian Geffon , Ravi Bangoria , Howard Chu , Charlie Jenkins , Colin Ian King , Dominique Martinet , Jann Horn , Masahiro Yamada , Arnd Bergmann , Yang Jihong , Dmitry Vyukov , Andi Kleen , Graham Woodward , Ilkka Koskinen , Anshuman Khandual , Zhongqiu Han , Hao Ge , Tengda Wu , Gabriele Monaco , Chun-Tse Shao , Casey Chen , "Dr. David Alan Gilbert" , Li Huafei , "Steinar H. Gunderson" , Levi Yun , Weilin Wang , Thomas Falcon , Thomas Richter , Andrew Kreimer , "=?UTF-8?q?Krzysztof=20=C5=81opatowski?=" , Christophe Leroy , Jean-Philippe Romain , Junhao He , "Masami Hiramatsu (Google)" , Xu Yang , Steve Clevenger , Zixian Cai , Stephen Brennan , Yujie Liu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The clang warning -Wshorten-64-to-32 can be useful to catch inadvertent truncation. In some instances this truncation can lead to changing the sign of a result, for example, truncation to return an int to fit a sort routine. Silence the warning by making the implicit truncation explicit. Signed-off-by: Ian Rogers --- tools/perf/builtin-diff.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index ae490d58af92..9c21ea8f242a 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -243,7 +243,7 @@ static int setup_compute(const struct option *opt, cons= t char *str, =20 option =3D strchr(str, ':'); if (option) { - unsigned len =3D option++ - str; + size_t len =3D option++ - str; =20 /* * The str data are not writeable, so we need @@ -1148,7 +1148,7 @@ static int check_file_brstack(void) d->session =3D perf_session__new(&d->data, &pdiff.tool); if (IS_ERR(d->session)) { pr_err("Failed to open %s\n", d->data.path); - return PTR_ERR(d->session); + return (int)PTR_ERR(d->session); } =20 has_br_stack =3D perf_header__has_feat(&d->session->header, @@ -1179,7 +1179,7 @@ static int __cmd_diff(void) data__for_each_file(i, d) { d->session =3D perf_session__new(&d->data, &pdiff.tool); if (IS_ERR(d->session)) { - ret =3D PTR_ERR(d->session); + ret =3D (int)PTR_ERR(d->session); pr_err("Failed to open %s\n", d->data.path); goto out_delete; } @@ -1492,10 +1492,10 @@ static int print_cycles_spark(char *bf, int size, u= nsigned long *svals, u64 n) =20 if (n > NUM_SPARKS) n =3D NUM_SPARKS; - if (all_zero(svals, n)) + if (all_zero(svals, (int)n)) return 0; =20 - printed =3D print_spark(bf, size, svals, n); + printed =3D print_spark(bf, size, svals, (int)n); printed +=3D scnprintf(bf + printed, size - printed, " "); return printed; } --=20 2.49.0.504.g3bcea36a83-goog