From nobody Wed Oct 29 12:50:33 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cxRtL0p5zz6DfQs; Wed, 29 Oct 2025 12:50:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cxRtK3z1Zz4JNk; Wed, 29 Oct 2025 12:50:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761742233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LhUSTe8nc/2dxZiV0qGzV3GO4NkN+LY/LxUtEhhfH7U=; b=CvDLvZht9OXnnWODKq6Vpgh5dB75g42NVZlgsiCDbWO9TfEainzH9SuINoZFpgmoIrq5+s z8YEdm3LuY9WuNSxX5VMX69o8o0SdhRX/+0how7/rw7WdHdIuIAcCB9AHxXDCS71cI2sap 1hsYxF/AlkJvfLs0EI8I8rCn1z32kylcWAKuJ8nLvmV3eOfMSbQkzQrxhtTLxRSxykwVhS WQw+X48hi3XElYpKLK5RhPNQe3fcpvKAvKtpaWb1HfQAhUGRQROv1u+o3k+60OIQWjjFGq drrbviy6Hz5FILeJVae/PIk8CJ6dWD4Q5XZp5FNZdIM2SKa5VLmGoVDEJdFqVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761742233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LhUSTe8nc/2dxZiV0qGzV3GO4NkN+LY/LxUtEhhfH7U=; b=iga7CbCGffyydTJ9xZmzfV8/Yc26r7Mbo1j//YcX6pdzFuRwR+7+lKumZR6Vd+KLbRt2IY kRm6YGDHJFoGxaWTZZiIndWv6A/B3ViQIYe5dxlaz2RUJxBwcHmWcFeiaGcJEwftPHK6qD tx/y9tYZjn3VBVQtKbzpyu3ZUs6Ccaz0KTTjevruTqEQ2LI+gOnXzy8/7RMQhngfH8GhiX 18WiQRfi91PgUlsgMbFZVMn1ZI3CCFk5fLzIhOBQhwgfV8WEnVLAOSJ8zwblYJQJr+Hy69 hIsM1i18sV4cUXz8XbFAPM2NCSpQmqs3nflh9zvO/FLDmXRwQoIH0ERRWvtIWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761742233; a=rsa-sha256; cv=none; b=X0zmSIF70Egy88GVwQx9JMdPUAuV9LL6bPIefwITLclS1JE7TwQptr4SEzRFMdOjPfjCWH yLUU78yaSP74YXGAwVGflv93sLQvjQqlFNZwrcOKXFz/IjC688jr1T1DvaZfTjzhntVGUe Qbi481IsARl86ffJj38fK4T4PAFgUcv6Q+g5E+HbU10WASdnbdXd4QMwB/9Ma2/aF4NmUn qOHnw3lUQ+3rnpwMQi6qoJI2T25x0PeDJHiwB5EAew6ihdv4tEsxyKEdE42hFNS+zFFtfN WO7LtYKMqp2OLHEJQ1Nl5c6SzDA45UbIDCdjy2UGNYCYp9IwmGr40mK1Srqjbw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cxRtK325PzcqS; Wed, 29 Oct 2025 12:50:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 59TCoX46021721; Wed, 29 Oct 2025 12:50:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59TCoXgu021706; Wed, 29 Oct 2025 12:50:33 GMT (envelope-from git) Date: Wed, 29 Oct 2025 12:50:33 GMT Message-Id: <202510291250.59TCoXgu021706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d779d823dafb - stable/15 - linuxkpi: Fix the definition of BITS_PER_LONG List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: d779d823dafb711dbedab15647b4ab9537487cdf Auto-Submitted: auto-generated The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d779d823dafb711dbedab15647b4ab9537487cdf commit d779d823dafb711dbedab15647b4ab9537487cdf Author: Mark Johnston AuthorDate: 2025-10-22 14:04:46 +0000 Commit: Mark Johnston CommitDate: 2025-10-29 12:47:01 +0000 linuxkpi: Fix the definition of BITS_PER_LONG Don't use __LP64__ to decide the value, as it gives the wrong result on CHERI platforms. Just define it in terms of __SIZEOF_LONG__. Make a similar adjustment for BITS_PER_LONG_LONG while here. Reviewed by: bz, dumbbell, emaste MFC after: 1 week Sponsored by: CHERI Research Centre (EPSRC grant UKRI3001) Differential Revision: https://reviews.freebsd.org/D53135 (cherry picked from commit 3e9ad70a30d93fc8bc759af7ec57aaa7e0b2d4f6) --- sys/compat/linuxkpi/common/include/linux/bitops.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h index 00dd1f9a1ec0..a5a7abd55287 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitops.h +++ b/sys/compat/linuxkpi/common/include/linux/bitops.h @@ -37,13 +37,8 @@ #define BIT(nr) (1UL << (nr)) #define BIT_ULL(nr) (1ULL << (nr)) -#ifdef __LP64__ -#define BITS_PER_LONG 64 -#else -#define BITS_PER_LONG 32 -#endif - -#define BITS_PER_LONG_LONG 64 +#define BITS_PER_LONG (__SIZEOF_LONG__ * __CHAR_BIT__) +#define BITS_PER_LONG_LONG (__SIZEOF_LONG_LONG__ * __CHAR_BIT__) #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG)) #define BITMAP_LAST_WORD_MASK(n) (~0UL >> (BITS_PER_LONG - (n)))