From mboxrd@z Thu Jan 1 00:00:00 1970 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 E1A1D22259A for ; Tue, 1 Apr 2025 18:25:29 +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=1743531931; cv=none; b=gL/NsB0ReSXW1rQU4yI8vRhU99pqnGiNjH8SaFfvyPL7DZPdoZ8cIt/19uEIrGnTJwaEBPMlkbJSweuv9JnlL9Ito+jKvQuurArvxnHeAmNCqLHgukYNPTBUaTfOLgRHEYj8rwkPa8//h35W9j80QQnjg47IpUB2bvHxeTfIM1c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743531931; c=relaxed/simple; bh=TQeWDd/yYWGLnY1+2vrH/bkxiRy1g+kcbMr3spHf3Ik=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=VL9xaoTL/mEhuICpKJx8vhZFU9Zqd2/x/7wsf5+hfe6hEUN4hh9sfynxUFwC7KYOEXFepYDpHMe+1U0l9nMopPnmibr6sgSq8vbzPklAamZWaEdduMgJqBRZO11AHyLJ/yoLyG9TmgZFhxEBToAWkxXnLtw3ZLE8m4NAe1WFpGE= 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=Q835z/pH; 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="Q835z/pH" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-225107fbdc7so105776345ad.0 for ; Tue, 01 Apr 2025 11:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1743531929; x=1744136729; darn=lists.linux.dev; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=7SpygHYpX3V6G/Y3lvn2849/ZYwPsF/CjG3vk8gdf8c=; b=Q835z/pHkg/Vd3aS7c3dF9sk2Vw7qz+99ghtwRZfRzWVc0kMiUHEWF2m2QgoqnH4zB F5efktmabVUmNbTO4wQ/V+2Pygjq3u77EG+iGLQB+vp5LuCm9KPK3M8P2yDt+rXfGCv0 ubU6y7M5JP3cpz8krnUB2XAQxmJzeO2TJAnwUy6NCaOVjpp+gy2h69aMqJw0CGAzmDzm OfvNeq46MvMLxYyh8hh7QgJY7KrmgKyO8YJwfMluQuyVkr4WuoupGxTllc7wcFyt+1+L BA+dLS+kM8jRvXv93Cls5X1yT+KBHWEhw38BDhbmQRHujgxvvq5LyOqr7AfADoanHOA2 NquQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743531929; x=1744136729; 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=7SpygHYpX3V6G/Y3lvn2849/ZYwPsF/CjG3vk8gdf8c=; b=LLebf+pBXFSzjeqA45CAtOW2gsUSdKulxK6uECTNsFB6pEe22eVRPxBECbxQL7yNWz EO8wDUuyCVTIpM4p/uadVG+UKiHqgrkdPw/Erq1BjUUFHhjU1IcwkGmFF2adL/oSIW2S qhmVMcexF0honbsfMfU5aVJqt7mXb615szOQJMgKCzC6swJ/HzO4TRQoTOhCBp3n6M7U WYMrJgzwiJjnjn9ErZK0HklQlch5wHBSMda0fokl/GjJbl21SvtLuVcI/fq0MbHiqWxo SkNJeK76IG4nI6DK9xjE9+GcUfUd/FgaNVfI1JTzyOOfpU276yjiumOJbNx9kf3nBwTJ hPvw== X-Forwarded-Encrypted: i=1; AJvYcCVpgJ7U5o8l64MlBZ2I+KGrxDt3v4jnyEhXPFHWlAiHc/oaxOVX4ikno7pS6SIBV2o5DScc@lists.linux.dev X-Gm-Message-State: AOJu0YwOOrDWgjBoMO2BGIEcspTJYa499f2EN2f8SBaNOi4Zxsjpu/XM ZJ8hbt2QwqTHqh3KrTqQz9g5bKlA8tFpB+jQDUs5dZYdeykywZbTAu5zRGUfRzvD082OSJ5vxBo qVVMB3A== X-Google-Smtp-Source: AGHT+IHidRh8ZohN9BAfCZsioNhjrSQYSS/qtPWBESRb2scl+HVatDzDtqJLadMCQ/s9lEK/qcgJBOyqMu08 X-Received: from plps15.prod.google.com ([2002:a17:902:988f:b0:223:fab5:e761]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:32cd:b0:224:2207:5130 with SMTP id d9443c01a7336-2292fa00e0cmr186146635ad.45.1743531928693; Tue, 01 Apr 2025 11:25:28 -0700 (PDT) Date: Tue, 1 Apr 2025 11:23:24 -0700 In-Reply-To: <20250401182347.3422199-1-irogers@google.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev 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-27-irogers@google.com> Subject: [PATCH v1 26/48] perf hisi-ptt: 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-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/util/hisi-ptt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/hisi-ptt.c b/tools/perf/util/hisi-ptt.c index e4cc4785f744..978f5781c990 100644 --- a/tools/perf/util/hisi-ptt.c +++ b/tools/perf/util/hisi-ptt.c @@ -59,7 +59,7 @@ static void hisi_ptt_dump(struct hisi_ptt *ptt __maybe_unused, len); while (len > 0) { - pkt_len = hisi_ptt_pkt_desc(buf, pos, type); + pkt_len = hisi_ptt_pkt_desc(buf, (int)pos, type); if (!pkt_len) color_fprintf(stdout, color, " Bad packet!\n"); @@ -91,10 +91,10 @@ static int hisi_ptt_process_auxtrace_event(struct perf_session *session, struct hisi_ptt *ptt = container_of(session->auxtrace, struct hisi_ptt, auxtrace); int fd = perf_data__fd(session->data); - int size = event->auxtrace.size; + u64 size = event->auxtrace.size; void *data = malloc(size); off_t data_offset; - int err; + ssize_t err; if (!data) return -errno; @@ -174,7 +174,7 @@ int hisi_ptt_process_auxtrace_info(union perf_event *event, ptt->session = session; ptt->machine = &session->machines.host; /* No kvm support */ ptt->auxtrace_type = auxtrace_info->type; - ptt->pmu_type = auxtrace_info->priv[0]; + ptt->pmu_type = (unsigned int)auxtrace_info->priv[0]; ptt->auxtrace.process_event = hisi_ptt_process_event; ptt->auxtrace.process_auxtrace_event = hisi_ptt_process_auxtrace_event; -- 2.49.0.504.g3bcea36a83-goog