From nobody Sat Feb 7 15:40:13 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 6BA24251782 for ; Thu, 3 Apr 2025 16:57:10 +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=1743699431; cv=none; b=CsWkQnQlfsDzP1gS98zgKDzbHPEp66RWTVXcz1R4WEpqVTW86FXJchfvXjKa0NG4zBFRZRwlTpUpttPVscM+hAxHZG0etitkj6XwADLbZsA0GNyVIox1LOxcm7ZAcjG/P4D1Agw5pRcC0X+tE5HZv45IXBhIe3Hx8pWcI/WJG2k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743699431; c=relaxed/simple; bh=zILY8QKhcQswVn+rw8O67wBaegmDIoNMhIlfFZckLcs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=cNpsUQSsBw3AtiqliVksS18phSY1/8Q6jJ47XZI9HMyj4iEd5Xo9CyCIKG/YluyajAMD1bYsrKoyX3e5PLbXlZdwNWeFg0FRIbANlTOQRzNA7CPjOd5kIALyUhBzn4kK69J4RWrB6xR8bQgiJRVLyF2iSR3RRoBgJZwRIwSqDco= 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=L5N/pY3X; 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="L5N/pY3X" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2242f3fd213so9238095ad.1 for ; Thu, 03 Apr 2025 09:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1743699430; x=1744304230; 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=aH7Ec5u6cTDPfyUdEzfgPdfyysE8iLjLm12xst9ksRw=; b=L5N/pY3Xwu7cJGmVOc4s2mpb2+FeeSV97OA4QM1mwXr1eZ5qMjfkw8Jxt7rSJ2aXAy mg4deDpMk90HxTJtlVVd/QmxEuH99QpYtrLj5CYyTrGsfC0SPV9awM4e1LiYYkcOFud+ FA4O0Q+BVQ3tVMItZMCdEOTtgIY+muFvtrubQgpoB5YQ3FIq29X1uJcdRSvfg39OsXVR OKLpj90z6KiPvIR45jiUwPDWiLA+3teanIGq42ErtoZoAIuw+En+s1lrs1QUuNPEFYkA ur4uWLczv28JaHytg/poE5SJXDEdL6IUqfrLY+6t231t8zVNYdg6LEkZeFzenx2BXBlR 55Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743699430; x=1744304230; 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=aH7Ec5u6cTDPfyUdEzfgPdfyysE8iLjLm12xst9ksRw=; b=q+0v+8Qr1ex3+qQGy9uXTPuwRjtV1oWlL/vz72LaK808qPhIqlvnqbyUFxLd859XK9 cxGoS1LSJVT9FVix/IhV16L/C8kwr9ym6P0ELhgZefiUzAxjZNchalFa7mkDLofh9uF1 G9JMX89uthSMkCHkWS5TVPipbxazMXU+NJ/+OPSvw/eUEEq9hPWgXlIXcc2MZ+bLWjZj B11oxbC4Xzg3OOvCjyLEq4I3HuBeqkVMQw11v4YCQkF41f7vjUo79z1ICX2peU9J9ryt r3YPyiG3DXQPlcbeNxbWUnq5QweIIIYWXRFO3wgRbBhLYwmRlo6s1dXs0+cL/oix12ve Ma8w== X-Forwarded-Encrypted: i=1; AJvYcCXR3peXkwlTrCOYdgB5NmXpfgihKUTrD1Zr5U0rUHImDAWpa1EK8ijA7bztc/F7Zp5XHdaFbo9mh036U/o=@vger.kernel.org X-Gm-Message-State: AOJu0YzmlAFD0q2p1qAcO/aJbu94PiaOz9cKiS/9SW8qzoPInNV2Xokg htftJjf0GyJsT7qV2dxV2lZtJjupEhcqMKtckvVextOYYx7Cg9FmndclzFYA4YVbkGrFvyaIWcW T5wOmdA== X-Google-Smtp-Source: AGHT+IG9oZEuu6NDkJoIa2JD9l2/TLvpDjP0WeNnnvefNvsoRX5iyB+xveOTqMHwj8Lg+En5G1S8314Nlrs7 X-Received: from plbjw20.prod.google.com ([2002:a17:903:2794:b0:227:e9e8:7153]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:22c3:b0:223:f408:c3f8 with SMTP id d9443c01a7336-22977d8bc8bmr47225985ad.14.1743699429988; Thu, 03 Apr 2025 09:57:09 -0700 (PDT) Date: Thu, 3 Apr 2025 09:56:58 -0700 In-Reply-To: <20250403165702.396388-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: <20250403165702.396388-1-irogers@google.com> X-Mailer: git-send-email 2.49.0.504.g3bcea36a83-goog Message-ID: <20250403165702.396388-2-irogers@google.com> Subject: [PATCH v1 1/5] bitfield: Silence a clang -Wshorten-64-to-32 warning From: Ian Rogers To: Yury Norov , Rasmus Villemoes , Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Ian Rogers , Adrian Hunter , Thomas Gleixner , Jakub Kicinski , Jacob Keller , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.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 --- include/linux/bitfield.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bitfield.h b/include/linux/bitfield.h index 63928f173223..cc5cfed041bb 100644 --- a/include/linux/bitfield.h +++ b/include/linux/bitfield.h @@ -176,7 +176,7 @@ static __always_inline __##type type##_encode_bits(base= v, base field) \ { \ if (__builtin_constant_p(v) && (v & ~field_mask(field))) \ __field_overflow(); \ - return to((v & field_mask(field)) * field_multiplier(field)); \ + return to((__##type)((v & field_mask(field)) * field_multiplier(field)));= \ } \ static __always_inline __##type type##_replace_bits(__##type old, \ base val, base field) \ --=20 2.49.0.504.g3bcea36a83-goog From nobody Sat Feb 7 15:40:13 2026 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (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 17EE42517A0 for ; Thu, 3 Apr 2025 16:57:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743699433; cv=none; b=HVYQINFJpbST2cs1ngxkPKkArN4b3/BWzqj+O0UKb+YmpgHtRLXSAR/BcJ+8NUvtKstnfI3pDj6HzmKF0OFn0wLQYaULR2T6+t9sfWwPehww0NGHd8IQvD7Jp4yI2Nxq7xlMJBjp/ChyHY55C1TuBBvib8vANPmFccMVRVj0UQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743699433; c=relaxed/simple; bh=EZ3OctgXrov4m1SIQQP0GA1CjxgdmMYx1wr5mwi8Yqk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=VfMYHnj5Lcaoef90sSmuEGxLaBTaDQH/gLOTEFGZt92LYN0VuryPGDVZRwpxl/C4z9BSRx7hG3ktS1zn071R6iNjHWNdijDrQo+SeVqG82qNvxUGrkPpGgtAlA2TmVDiFEocx+vd9eacRRiXkuuZ/AiHu7ap3050CVT6gJxn+Ik= 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=OgU7Xa/H; arc=none smtp.client-ip=209.85.214.202 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="OgU7Xa/H" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2242ade807fso18529305ad.2 for ; Thu, 03 Apr 2025 09:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1743699431; x=1744304231; 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=2vMMUbWfGWJtt6qJg5TEjuYkc7LyjFLPOch4giCzBAE=; b=OgU7Xa/HYF5IzkO29gyfVS1HKvcN3DWqUnzGJ/wNcJHfe+oPg5b1QyhCIRxI9jmWtJ BAOzlGID9msHTmJcl51z+A2aDZmu6YNjI0HL1Ls18FLIoN6EO1yBN0KrL2mwbObxhaVh D4yGE7B7aex2fXpFE+RKEe6uRykh5t5VXZE7l/tH6KrSPhc002keSPgOvZLyu6P6TSNV L5SxDe863uULVLW4G9ogKEnvBxTIp8oZBr6unndaNdHmXZ8rrCrAjQkFAZOjhoILL4z6 TYXr35eXJsk63DFj/b2DXo0K2F6Po3nJc0pS8MLkYMsj8t7YNCtIDvqNo3YAgH5Fg8rT d+7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743699431; x=1744304231; 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=2vMMUbWfGWJtt6qJg5TEjuYkc7LyjFLPOch4giCzBAE=; b=QdOwQd6LCWHqo0v6oWHmOkxyxqxCzVmBibNRpemwgbW2zF1aV8FxDsxVTD3unksFVZ jChIfr++krrRMUYJMAQt6JpamDwV8cgwvT7jxEMjJpcPjzdv100mwv9tKPun96QXUElS 7ZAcidI51atDF89lp9tKP7GBz7kLPdYeBrGQODqca7TOyCEK5YqMLTOhxNOaOPa8ygf0 HzxTWrYxwGK1HFiDl7Lm+7EYnTEbvvKZEl/CfmErktWVXvOvUCGwByYLy2eHmat1Q3fD LeoGVWl4YtWk1HKRV4vEg4ritnesFVixAsDu/UTzyjcRXUEPhqZySOVl4EwZqn6ot9N8 ScRA== X-Forwarded-Encrypted: i=1; AJvYcCXWKF+1SpHkPCsdMFc+FKNSOcrhnSdn1LZ1jlJMi1Vlhf1mgS286oJ9VxnmLyu3+xUY5/6VrnFoxwER9HU=@vger.kernel.org X-Gm-Message-State: AOJu0YytDjpnwWBPmK28wb+3gMxMy0aDC5Kaqz4ATe01L1rMilShOc2S oL1HtT/FMmlpFriBgc/n+5FYmeVwGl8qB9/dCjeQPJRYPIx4YBRhklRyRpQZcdcMfDNqtaNGVsN Bjv+uwA== X-Google-Smtp-Source: AGHT+IHVdW6EuuBxX0sM92CTGs0VCjkpUZ5/eKwIrxGT0OKUKkZpfgTf7TdCK0KWd6NyRz82u0in6WUHraY0 X-Received: from plsd21.prod.google.com ([2002:a17:902:b715:b0:224:2ae9:b271]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:f552:b0:224:f12:3734 with SMTP id d9443c01a7336-2292f9e298bmr322176305ad.30.1743699431571; Thu, 03 Apr 2025 09:57:11 -0700 (PDT) Date: Thu, 3 Apr 2025 09:56:59 -0700 In-Reply-To: <20250403165702.396388-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: <20250403165702.396388-1-irogers@google.com> X-Mailer: git-send-email 2.49.0.504.g3bcea36a83-goog Message-ID: <20250403165702.396388-3-irogers@google.com> Subject: [PATCH v1 2/5] bitmap: Silence a clang -Wshorten-64-to-32 warning From: Ian Rogers To: Yury Norov , Rasmus Villemoes , Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Ian Rogers , Adrian Hunter , Thomas Gleixner , Jakub Kicinski , Jacob Keller , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.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 --- include/linux/bitmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 595217b7a6e7..4395e0a618f4 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -442,7 +442,7 @@ static __always_inline unsigned int bitmap_weight(const unsigned long *src, unsigned int nbits) { if (small_const_nbits(nbits)) - return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); + return (int)hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); return __bitmap_weight(src, nbits); } =20 --=20 2.49.0.504.g3bcea36a83-goog From nobody Sat Feb 7 15:40:13 2026 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 4314D2528F2 for ; Thu, 3 Apr 2025 16:57:14 +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=1743699437; cv=none; b=lZ5WWaxtERlIwrzfvcV9O3OOJPRfZqlwQMjP1E4wYEoi3PR87c34SlgJjl9h9W52AZ1mEH78Y48p47eHow75Ep1UjAWNc2Cka0qjmu3UruiBQ/6zY8GuX5hEYfDRTvvYCn5qXPQ0L29Ze8ZJbrIhBuftmOxlD/9JU6O+fprnCio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743699437; c=relaxed/simple; bh=Qz0QomEC//r00eQAz30vgB3K0BsSHU+UqMrkppYie2E=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=CxkqhtHJ+E7rnnLace5MtnqlCe3fTifP+Yrx0CDreP/IZKRf7RljxPPVQPIyFxSx0/d9iYLDWfy7SrcZMM9IEJkSMDQwnBZrW5RoQHiRKm5MBarPkLsDb6VJEwd72HJGDMMEEZAZY+PrlPORfnTMq/AuuPpqySgLieWUpWpiPlg= 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=B1o3lMzw; 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="B1o3lMzw" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2ff854a2541so1051048a91.0 for ; Thu, 03 Apr 2025 09:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1743699433; x=1744304233; 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=qW8HptWxtTGnb+NyUFSz4Rsqb7n3gW/Agd38GBuyPl4=; b=B1o3lMzwD14k3bQAZ1MkTFtPfdRm57m0XkwJqZ56pieytS+1MjjhvMb7ZdPIUxJs2a cz82DsWEbendEHhSFmw+048SMdpzyZBBc97CSh07M9o3nEevDV9fC5kuboK8XTTJG2Tb e5wS4UniK/VCDtThybyK7zLV/NVEGEmKAVRAJ1FE7MRnmPbw7lZ+iory8vrslXWYRnvH BmhO0fSiBeq9s220qz29hVGwzZ+EnU5EhDyTzyGxd+YRrHH2MJvELwMtgcS4R3mjHMLX jysuxpCKJA0F5o9Rx4zuh2MOIMtHiQ/+msHugU26XdY9lvbNBWd7Luqcnv+FWr+IWwWZ 24vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743699433; x=1744304233; 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=qW8HptWxtTGnb+NyUFSz4Rsqb7n3gW/Agd38GBuyPl4=; b=vgVDjtndF3+9dG3dBjB5Ihn5XYKUhUETVEoi1/rypRZiU+sVND4rVnooM/z31mJMym 3MJ06Kk+0uHRNCNHNNdHZoH4m3Z6Yd2ZEtOak30MCss/AQ+VTEiuK8xSjPnFMwTOkFu9 jNYyrS+En37xe7GQz8sFl0VTE/YSE+/JFsCxsYyTXLwJlLbwI3S32IHzjZCMk0VjPxwz ZMoAKnv2Bo6KdraiHCUtCkNlFvBddH5gzN6weDrOvyAldoVXgsNhb6huxOwZDmgMk9nE k9Uw1paQyDOibq/swFbQG12qznRB7VqA0SySQoerPzQn43kjzIhiaW7IwrgggEjG+zbi +qbw== X-Forwarded-Encrypted: i=1; AJvYcCW/DjO2xvLm1hRt0THVlcTKzhQ+OjE1n4GRtzaJp0jl4OrK5nZT8KtEL45IjGKoVR8mQUDWsf/4zLyP9M8=@vger.kernel.org X-Gm-Message-State: AOJu0YweKG43Ob45qZ7oWFZG9r9I7RMHPAfuSRqXDoeDsUlliNHpat+0 FItXsKvVKPg88XbcbKG8x3ud28l37yWtzhuv72+TBSHnaPI5DzvkvnEm6EiKKM/hCDFjHS0hhSD oa0dx3Q== X-Google-Smtp-Source: AGHT+IF0CIOoJJeJRQHOUC3EpHHqa58y0n4/IbXEbLHpY4GALdcPXwOZpF/CmwFTc4V9Kvparfq+Lmxq0y9x X-Received: from pjd11.prod.google.com ([2002:a17:90b:54cb:b0:2ff:5752:a78f]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:1b0d:b0:2ff:52e1:c4b4 with SMTP id 98e67ed59e1d1-306a4b8597emr236433a91.32.1743699433573; Thu, 03 Apr 2025 09:57:13 -0700 (PDT) Date: Thu, 3 Apr 2025 09:57:00 -0700 In-Reply-To: <20250403165702.396388-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: <20250403165702.396388-1-irogers@google.com> X-Mailer: git-send-email 2.49.0.504.g3bcea36a83-goog Message-ID: <20250403165702.396388-4-irogers@google.com> Subject: [PATCH v1 3/5] bitops: Silence a clang -Wshorten-64-to-32 warning From: Ian Rogers To: Yury Norov , Rasmus Villemoes , Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Ian Rogers , Adrian Hunter , Thomas Gleixner , Jakub Kicinski , Jacob Keller , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.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 --- include/asm-generic/bitops/fls64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic/bitops/fls64.h b/include/asm-generic/bitop= s/fls64.h index 866f2b2304ff..9ad3ff12f454 100644 --- a/include/asm-generic/bitops/fls64.h +++ b/include/asm-generic/bitops/fls64.h @@ -21,7 +21,7 @@ static __always_inline int fls64(__u64 x) __u32 h =3D x >> 32; if (h) return fls(h) + 32; - return fls(x); + return fls((__u32)x); } #elif BITS_PER_LONG =3D=3D 64 static __always_inline int fls64(__u64 x) --=20 2.49.0.504.g3bcea36a83-goog From nobody Sat Feb 7 15:40:13 2026 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.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 77AEC251788 for ; Thu, 3 Apr 2025 16:57:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743699438; cv=none; b=HQ8VadYYfhDh/sDC+xbf3y0GYyq8cN6Xr2wf28QNT4IsR19I+XLkBgKP4RAtOS+STLilkrZEMDQIUQ12nUFdKuqlU+p2C/aNCxTZcqN9suXqsx+lq0keTvYsMZnefCL4laIsdlYIDb0ILixAZQMyihMSCcRZu6f8+JDwIVn17ro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743699438; c=relaxed/simple; bh=pZlVCJRViECraWY8Y+BJqWX1y/rA40Dggavq4E6VOKI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=WGwRVie59mbVUUcGCZbLDWj/vIu2ozhO4g1re9cULA64Be3nmRDwkkPTU9Eo+Q/yVvPg5+jrPYCu24WiE8wJJGyzNi9ZGQfcdkusZDGEJos+JdSq54OzDWsibQ0eVkagZaas5B5xES8v1cEiezfKHLfkbEuyuxlyLTrTIdXsqJw= 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=nJ5gbWGW; arc=none smtp.client-ip=209.85.215.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="nJ5gbWGW" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-af54a9109f4so501843a12.2 for ; Thu, 03 Apr 2025 09:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1743699435; x=1744304235; 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=qdGNPnhkmnSYFw1hLabTm19S3ZzmXtS5SLBi0D4Xb94=; b=nJ5gbWGWxkrptEFGU3qd1VQLU1CRLBZMUx/GazMVA5EpeS2uHrpE0tanTvIbQK4PUU 5K0sdUI7ta8ZX13vxbKP8NY8H1bcy+TuiepRnaIf+3rv2U9iXptdXI8mEcylCArSxk2K pSWdqJfZGRC/d9sVFCZkiqUfmFh7JoSBPWjQxk4SAKrH5Rfqqh891srk08kKTgyiR/xZ uvNOjYXO3x5ZPY/IOmo0laIzNF0X3QQo7Q3ThK4Ae7aMnJtY17mYjN97QllNUL/iN5Tk 9KeqY1sD7CWBiHjhYd2SCAVyKNRpRdw0NV2+mNgK6GeYlY4nw0SHIML5YMBVezK1VjO6 q0Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743699435; x=1744304235; 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=qdGNPnhkmnSYFw1hLabTm19S3ZzmXtS5SLBi0D4Xb94=; b=QHHTTuRI/HBeSj8xt9d86Xujkt9yV3TfNjwNL6dVQ14vvX2hvZMH/S+QbogRW/fQhB aHL4Dy1xfhQGSyRSs1tMGuh9fADqia1d85DcxopN1Am3jszevU4ZaPQlMVQEijL3/g+e yDujx6Nfd3ZoQaWzCi4DfJNyKv/SZ9DXhV+PnzCjZ04KlbivzINGcoYEAMWY68KmVqqy FqN89zTavf3aRnWWSCzTYwJtRi3ngpJlS7LvO9h0JL2AMmdAptBYGwMup37TNFgKVHNl zS2QX/ZlGbpu6wlEh+zFhAtrpxqlr2MFI+iN2xPCISpFkYuvykoPAZWZOHY1P14LVLeb CXAw== X-Forwarded-Encrypted: i=1; AJvYcCUPiwIl568bxpgDBS8lUqeKdykg+wLKFSYwyQFGTCbaZjzb7qqPtCNiJBuhiXD+L/uPpP4jarLn9YZ9NRU=@vger.kernel.org X-Gm-Message-State: AOJu0YzPCSwvrzAvn/qLaGakC11L9FbaNvawG3BbqkmGdUGavh8Iqffz RI6fOmPuKpY0ZHjq1W5w/K911TwKVegDJe6SMJjd9lFUQKjMrCHxjFWj+r7kB9mWrlqBhqHLesI pMUc+6g== X-Google-Smtp-Source: AGHT+IHf4+lZdfNC4Pd+fVVLfgEfGYIen3a2OuSa3UqLYxlvTyLWi+hHtj2Vluq/obtqYLkaNT1ivwRzacjy X-Received: from plpn4.prod.google.com ([2002:a17:902:9684:b0:227:eb6c:504a]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:1c2:b0:227:ac2a:1dd6 with SMTP id d9443c01a7336-2292f974a5bmr344475055ad.24.1743699435654; Thu, 03 Apr 2025 09:57:15 -0700 (PDT) Date: Thu, 3 Apr 2025 09:57:01 -0700 In-Reply-To: <20250403165702.396388-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: <20250403165702.396388-1-irogers@google.com> X-Mailer: git-send-email 2.49.0.504.g3bcea36a83-goog Message-ID: <20250403165702.396388-5-irogers@google.com> Subject: [PATCH v1 4/5] math64: Silence a clang -Wshorten-64-to-32 warning From: Ian Rogers To: Yury Norov , Rasmus Villemoes , Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Ian Rogers , Adrian Hunter , Thomas Gleixner , Jakub Kicinski , Jacob Keller , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.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 --- include/linux/math64.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/math64.h b/include/linux/math64.h index 6aaccc1626ab..f32fcb2a2331 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h @@ -179,7 +179,7 @@ static __always_inline u64 mul_u64_u64_shr(u64 a, u64 m= ul, unsigned int shift) #ifndef mul_u64_u32_shr static __always_inline u64 mul_u64_u32_shr(u64 a, u32 mul, unsigned int sh= ift) { - u32 ah =3D a >> 32, al =3D a; + u32 ah =3D a >> 32, al =3D (u32)a; u64 ret; =20 ret =3D mul_u32_u32(al, mul) >> shift; --=20 2.49.0.504.g3bcea36a83-goog From nobody Sat Feb 7 15:40:13 2026 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.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 8F35C253322 for ; Thu, 3 Apr 2025 16:57:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743699441; cv=none; b=ST5kpQKbcQ0IbutFwER+K/MGGFJV+EQTFzvzXpuVkJesc2RI7ARLh3xXBNPYeI3j6kncMMlMsXJ2sHQEbBgIxefTOMLeCwijSqqYcGn0bvOpGG6B9y4mVnDsnRcG8BWtRjn9rXWPvA/KxgF7h362WYwOSFwAPkAolRXheje8+WY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743699441; c=relaxed/simple; bh=1GBMY/blDMm/pZBEDDJ7pMxBepJY1ykTDsdud2Ofj2U=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=t0tj7LU/UCnIww42OOfrKxktZIov/o4TAk5Eld40uuQDc2BY8wnZZrml8KvHXgziBX4ZT3nvT6Fony2tCaaPFZjVqq8MrAiw+JvgnbtkeEeHYtGKCrqp+3LhlW85GS4Jc6y8hMFK/CjcmYSFflEPhLn4c255QU+IHNCP/sBqSQY= 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=yvc3WPSL; arc=none smtp.client-ip=209.85.215.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="yvc3WPSL" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-af9564001cbso845299a12.3 for ; Thu, 03 Apr 2025 09:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1743699438; x=1744304238; 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=mNHCeBq+kt/FIoDgbEk42F0HhswOr1VLdQ14FXQaWQs=; b=yvc3WPSL11RWLmG4EvleEX73gnbfC5u/aeOF1Dz7frXMQqQ36cKW8UD8MMzJKUIkhS 7ydB4D28QJ+r6RgOlgHZelz5/KrEURSnpbjE5pPfomPBjHsQhGDMRI+qboaQJKlGohMo tvEKgEUyEW1Y1fXbRRoDFHceYS7Tp5WTiK1mxfgB8TxE4dcZUTi9qBSQv6OLXh+VAztZ medFK4CIz0QAAJgcfOs6ZkbaMQQtlGNQ0SMr2lMQ1SyCm/onySe7ifE07GRf6nSoujGL fg5nJUbPhElSlcugRCl0jU+UendNjeU0SJzbE53czloue6w6RP/bDEH8QyoyQEwSJrIY thQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743699438; x=1744304238; 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=mNHCeBq+kt/FIoDgbEk42F0HhswOr1VLdQ14FXQaWQs=; b=urCLDDALrBhGbzSLH82y0GZtsrQzutzaL8gD6AF3WuGvMBTLD3EQRQZ74wPCVAZStB hKdWgdXRpuiq+4O+GYPv5Nz1Z5r9X5jL9mtG2Av279Zby08OpFhETQdr4FwMjGC39h7a VEpomdhjHymCc7HItd6ncREWfgYGviF6BxDp2tExNvxR4L7EBypfqyBrjSV80V1BbQpt JNTX6H4wZQ54q9s73MDRzQcr+zZLgqhCTkaX6ZtlzTHSjwy6PCFXzbWipHevBKp9X0gu 3/ivp/XRKuRe+PLnXQVvTw0DlYNkadGp9gg9eiIGZEVAvdjkukRNuWLd5mKH21n3Qaiv k1UQ== X-Forwarded-Encrypted: i=1; AJvYcCVwoMnovKk/1rttuubQvjl7Pb1P3gTt7cX0K39k3xdPXAgtOXTK7q5agefpncRvVD8h6h7rWZ+2GdQzTpU=@vger.kernel.org X-Gm-Message-State: AOJu0YxncIHBDVePpN/GEOET2Q/Ysvd90Mc3Up7sNEmjK/49dFqbcLJ3 GsQeWjoJBVANHAlocHhYlr2tKkWK9zw51Px18gtimhS7sB3RYRu/vMU4Pon+OttBI9Efu6FvuOq hzLPLjg== X-Google-Smtp-Source: AGHT+IHwAF9KgN3kBG96nyN/c70dCrvtSADqCvq2NC2KDP9UQWERHeR8jrgnBfjzks/VkiX6BY+HKFC/mvhS X-Received: from pjbpb6.prod.google.com ([2002:a17:90b:3c06:b0:2ff:5344:b54]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:574d:b0:2ef:67c2:4030 with SMTP id 98e67ed59e1d1-306a4975c0cmr355393a91.27.1743699437820; Thu, 03 Apr 2025 09:57:17 -0700 (PDT) Date: Thu, 3 Apr 2025 09:57:02 -0700 In-Reply-To: <20250403165702.396388-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: <20250403165702.396388-1-irogers@google.com> X-Mailer: git-send-email 2.49.0.504.g3bcea36a83-goog Message-ID: <20250403165702.396388-6-irogers@google.com> Subject: [PATCH v1 5/5] hash.h: Silence a clang -Wshorten-64-to-32 warning From: Ian Rogers To: Yury Norov , Rasmus Villemoes , Arnd Bergmann , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Ian Rogers , Adrian Hunter , Thomas Gleixner , Jakub Kicinski , Jacob Keller , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.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 --- include/linux/hash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/hash.h b/include/linux/hash.h index 38edaa08f862..ecc8296cb397 100644 --- a/include/linux/hash.h +++ b/include/linux/hash.h @@ -75,7 +75,7 @@ static __always_inline u32 hash_64_generic(u64 val, unsig= ned int bits) { #if BITS_PER_LONG =3D=3D 64 /* 64x64-bit multiply is efficient on all 64-bit processors */ - return val * GOLDEN_RATIO_64 >> (64 - bits); + return (u32)(val * GOLDEN_RATIO_64 >> (64 - bits)); #else /* Hash 64 bits using only 32x32-bit multiply. */ return hash_32((u32)val ^ __hash_32(val >> 32), bits); --=20 2.49.0.504.g3bcea36a83-goog