From nobody Fri Dec 19 17:27:02 2025 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 C912D2983E8 for ; Wed, 30 Apr 2025 17:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746035540; cv=none; b=tGZoRq3ANeniCGMo1n8hFcT7yDhGm+z51egkqV3WImnci+/ig/WbSNJRJTyaq++d5b4hMQH1Z/f9riKLi1N5N8zEziMWX8zB2bRsZo+FJ/MeV/AYRoYBwNWVQFwH52jJkspbSyDk/ClRCMTbrflBU+9ynNYOC/ZBs4dOj9XEYeM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746035540; c=relaxed/simple; bh=X7ayYarIFslbLLtsLDqK4tsTxxIhw1Fw48lPCUEOBWo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=oFRRyQiieQid+kOW5ks15bZ2q4Iywci2c7maP4c3O1dHYvVAS2+i3OunDDDv985xu2OxkythRHpghGmcl39TmGWr3GwPCq6GQecww9H8Ohsl2kfqC94i1r3gD9+VE4mql3cww4mdd8V8MwGTjmK+AZrmOrtgJEvq5d3TD0b35Lk= 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=OCkevx6U; arc=none smtp.client-ip=209.85.216.74 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="OCkevx6U" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-30872785c3cso250016a91.1 for ; Wed, 30 Apr 2025 10:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1746035538; x=1746640338; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=FY+AhXNeHM9fvvryKR588grjwTzwmRayIi3f4UurhvE=; b=OCkevx6U91rIZiyiE1XPpWN/KzY/ApIUEt/2Iq5uA8+iyFyXo9i71sECuzeiiNJvRl kirTjBiOgZxglDfb9IMQUcsB6pb2OivpzF/zZD9Cq7xswqG46mlzzAjTk+ipFADqFLBO 7jP0ydr59b869CZqoAUYgZI1CVpWuFEQmVXWolnaW/FcWboPS7/VMdSbN9VRjehxi9P7 qOArHb9N7nhAAhu5o38JD3evHxp3FOq2+SLJho8ilJIlPAl5LaVBLweVBlVJ4G+wklc4 wiDsfN7dHKsu5+LkyPueyR90q1TD8DRzt7G0Mdwb8Yvu9eqCWn83yq59cYjOXZb9V0tc WwVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746035538; x=1746640338; h=cc: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=FY+AhXNeHM9fvvryKR588grjwTzwmRayIi3f4UurhvE=; b=q5sVLXTLBPg0R4ZKasgGADBGo5ug9v4B+HqYys910LFozztZkr5C71nPhioOA/0P48 whej5Q3FOqSMZ3BT4XuQGSyDm8ksJEkkjXSPJZumwTUAAOXFgEiufWkKdzxLGCjZJLG0 bVVyF7H8w8Ujt4J3QOBVfh0IBUpO+nSRkMQ1bQqg14Ejis95zqgnOC5CkNChkRu9DYv5 WXJyPcFIldeMDT+WBoZNnkDKThj9rYcAnHb9X3kiUCVYj7mlhQSqL2l868hF3Jpq43Ln n99q+WbEXbp8Gbgrdy7AsDsYR7WZlKaXuBPcjjVjZPmGGm7QUkyvaQsAIQVLc9Ih/Nuo XLjQ== X-Forwarded-Encrypted: i=1; AJvYcCV5R8fqG+lxGPxDTEexkRlknaADYGZAWwr5XV/5r75dAElcJD+/NN8/lsxWgsuWmeepOcQIAGCVb2Le8Hw=@vger.kernel.org X-Gm-Message-State: AOJu0YwNaB1iWZPnz0jg4vMc8v+qaHpzTXMgLGAoYKMIrq0ZaQkS+1CQ wlpfqutSbjnrekb2RdAUrGy8Z6oe64spnWr9Z/ZX8i1E4elAtQjZ2UmU4M1QJl8/1DaWlvsQNGF Os2F36Q== X-Google-Smtp-Source: AGHT+IE3SvE/3M//FPmVxa20Y7yaBTKb6cpmpVwiYcI4Thv+DfvvJxrMk6sGwWSsSGI6Aw0EzedIm7xTjv4i X-Received: from pjbsv4.prod.google.com ([2002:a17:90b:5384:b0:2fa:2661:76ac]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:1d48:b0:30a:204e:3271 with SMTP id 98e67ed59e1d1-30a33300d8emr6527144a91.17.1746035538234; Wed, 30 Apr 2025 10:52:18 -0700 (PDT) Date: Wed, 30 Apr 2025 10:50:28 -0700 In-Reply-To: <20250430175036.184610-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: <20250430175036.184610-1-irogers@google.com> X-Mailer: git-send-email 2.49.0.906.g1f30a19c02-goog Message-ID: <20250430175036.184610-41-irogers@google.com> Subject: [PATCH v2 40/47] perf kvm: Silence -Wshorten-64-to-32 warnings From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang , Yury Norov , Rasmus Villemoes , 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 Cc: Ian Rogers 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-kvm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 67fd2b006b0b..a81874b7f2d3 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -928,7 +928,7 @@ struct vcpu_event_record *per_vcpu_record(struct thread= *thread, return NULL; } =20 - vcpu_record->vcpu_id =3D evsel__intval(evsel, sample, vcpu_id_str); + vcpu_record->vcpu_id =3D (int)evsel__intval(evsel, sample, vcpu_id_str); thread__set_priv(thread, vcpu_record); } =20 @@ -1337,7 +1337,7 @@ static int perf_kvm__handle_timerfd(struct perf_kvm_s= tat *kvm) uint64_t c; int rc; =20 - rc =3D read(kvm->timerfd, &c, sizeof(uint64_t)); + rc =3D (int)read(kvm->timerfd, &c, sizeof(uint64_t)); if (rc < 0) { if (errno =3D=3D EAGAIN) return 0; @@ -1558,7 +1558,7 @@ static int read_events(struct perf_kvm_stat *kvm) kvm->session =3D perf_session__new(&file, &kvm->tool); if (IS_ERR(kvm->session)) { pr_err("Initializing perf session failed\n"); - return PTR_ERR(kvm->session); + return (int)PTR_ERR(kvm->session); } =20 symbol__init(&kvm->session->header.env); @@ -1924,7 +1924,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm, */ kvm->session =3D perf_session__new(&data, &kvm->tool); if (IS_ERR(kvm->session)) { - err =3D PTR_ERR(kvm->session); + err =3D (int)PTR_ERR(kvm->session); goto out; } kvm->session->evlist =3D kvm->evlist; --=20 2.49.0.906.g1f30a19c02-goog