From nobody Tue Feb 10 04:23:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C6E31F956; Thu, 28 Mar 2024 14:31:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636278; cv=none; b=I/aMZhZKsjWXGMdIEyd+k2KLYzLZrzrENIWLWPyUWIsBn39p74R5+AxdnuzNWRG1mNaeKbNEqQZC8b1g34znxgQA4kcpPPgjJEAiIbtGOjEsxXPWU/LLn60/9qV8De7/LI9qts7riC1uFXIqLwqrl6kANHrCqzJxjanMNLZo4bI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636278; c=relaxed/simple; bh=qLTItqdV1pMOYIR5NzMljZd3lTmzZJ0cmUVlffUJXOA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vFkZ4zXWwPcnwdfy0/I7FOCwkHhL9fZmrPfDGDW6A2eccaZrJCSVcU851qr8UsnFBOFFfvNzgAADQa9zxae2q8lvA+2dvfAkXop5TdBgyebbkmsFUWChlAM3/xWs83u5CCAAZhxMEX3r3HWBtQCswvgPEFZ02VpPihHCoQgMvoY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H2d9fAo9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H2d9fAo9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51975C433F1; Thu, 28 Mar 2024 14:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711636278; bh=qLTItqdV1pMOYIR5NzMljZd3lTmzZJ0cmUVlffUJXOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H2d9fAo9l+RMifg9C2gpTjTxtlEnbc65SGwqNNTgbuuAzhHYgA0P0b28L4CPW+sr9 Fpsi7I9Q/+gpZbbFSciEBbv0/hg1HbU4xm4U+DFd+T4rdxu8ZzYlMTUi2Dw27ecOnC zVy7RasweOpWGuyMmIR5SVzq00iMsmny+OJTVHCQ8817jhQFjP35hr5beC6UDeKt3r pJm5XmRO6l2P0tAugEtHwHbjj3AgZvXxzSL4eREX0TIzGr07M4U3E5BIO7JVbdoXNh ip3KAasRyCAFwARgbJlqvzan/ek5Nd7PRO8gnel3VqSqTvJhCwbKG1BDKVTruPzA/+ eOkIYSsAlAO0A== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, Nathan Chancellor Cc: Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , Eric Biggers , llvm@lists.linux.dev Subject: [PATCH 1/9] dm integrity: fix out-of-range warning Date: Thu, 28 Mar 2024 15:30:39 +0100 Message-Id: <20240328143051.1069575-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328143051.1069575-1-arnd@kernel.org> References: <20240328143051.1069575-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann Depending on the value of CONFIG_HZ, clang compares about a pointless comparison: drivers/md/dm-integrity.c:4085:12: error: result of comparison of constant = 42949672950 with expression of type 'unsigned int' is always false [-Werror= ,-Wtautological-constant-out-of-range-compare] if (val >=3D (uint64_t)UINT_MAX * 1000 / HZ) { As the check remains useful for other configurations, shut up the warning by adding a second type cast to uint64_t. Fixes: 468dfca38b1a ("dm integrity: add a bitmap mode") Signed-off-by: Arnd Bergmann Reviewed-by: Justin Stitt Reviewed-by: Mikulas Patocka --- drivers/md/dm-integrity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index 37b9f8f1ae1a..7f3dc8ee6ab8 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -4221,7 +4221,7 @@ static int dm_integrity_ctr(struct dm_target *ti, uns= igned int argc, char **argv } else if (sscanf(opt_string, "sectors_per_bit:%llu%c", &llval, &dummy) = =3D=3D 1) { log2_sectors_per_bitmap_bit =3D !llval ? 0 : __ilog2_u64(llval); } else if (sscanf(opt_string, "bitmap_flush_interval:%u%c", &val, &dummy= ) =3D=3D 1) { - if (val >=3D (uint64_t)UINT_MAX * 1000 / HZ) { + if ((uint64_t)val >=3D (uint64_t)UINT_MAX * 1000 / HZ) { r =3D -EINVAL; ti->error =3D "Invalid bitmap_flush_interval argument"; goto bad; --=20 2.39.2 From nobody Tue Feb 10 04:23:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C39912D77B; Thu, 28 Mar 2024 14:31:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636290; cv=none; b=SHlVZSnNDHv4t8Y7Qy/Dn6fnrXuWwc7+VvzhllHQ8OJrgNYVx4phCyuP644iDuWto64Nq2NU54yZyC3bO91tQ6y7XqmPVvRQvol8xH0smk8Z1W2eGmoBixaKDU4OaSqxhu1NUB4lahhMx5P4YeYNXMO19ivjmxAe4HzP0EWWggY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636290; c=relaxed/simple; bh=CLKmSwfWJ51R7yRH9H4Z02ae07/lsbxBLTkdp9cvOH0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NV6FqXfv7be4XkFVHyDPcZKorlDvkb6Jm74KCAb0jM/UFQCDh44p2Z9/1plwbPi3tPcCd7/osYwZl7iakv1gek7Z8jBSYI5JzMA8hATp/8E8T2C2Gd2vgC7NDarC73VBKLl/B102P6PVdsrFV1ZFe/dSLwavtoAoY28mXelMENo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q6rPZGLf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q6rPZGLf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7265C433F1; Thu, 28 Mar 2024 14:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711636289; bh=CLKmSwfWJ51R7yRH9H4Z02ae07/lsbxBLTkdp9cvOH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6rPZGLfjJ85hVRL9zvH78xHWI71xn2Fvzu/M5q0+HDEkrd6TQ/WnLodC2ogsLTvr sB+1VLU0PVi30PcYICt9g8mTpwOMIDnovxTMxNzgc0eyT/e924ZhQ9TUMmE+BmyMdS Et8bKBZWJ2FTljWdJZ3OH90jTqoDxKWp6NVsDt8xZ5mpFYCJFXWCRSPoG5QUOWJZuu KpwIfSk1FzjWLZacCXDuyX7jJuyJqU31+/HZEs0shtldrC56E5tOQI5oTRs4RyXRHU 2zkvnh6eg1KMYnPyAs6+3p3rTSy9AsqD/VRw+TEMXlc+oqz4tIiOfkfeaOjp6fL+gd Q9E045wcHMrww== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Xiubo Li , Ilya Dryomov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nathan Chancellor Cc: Arnd Bergmann , Jeff Layton , Nick Desaulniers , Bill Wendling , Justin Stitt , Milind Changire , Patrick Donnelly , Christian Brauner , ceph-devel@vger.kernel.org, netdev@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 2/9] libceph: avoid clang out-of-range warning Date: Thu, 28 Mar 2024 15:30:40 +0100 Message-Id: <20240328143051.1069575-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328143051.1069575-1-arnd@kernel.org> References: <20240328143051.1069575-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann clang-14 points out that on 64-bit architectures, a u32 is never larger than constant based on SIZE_MAX: net/ceph/osdmap.c:1425:10: error: result of comparison of constant 46116860= 18427387891 with expression of type 'u32' (aka 'unsigned int') is always fa= lse [-Werror,-Wtautological-constant-out-of-range-compare] if (len > (SIZE_MAX - sizeof(*pg)) / sizeof(u32)) ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/ceph/osdmap.c:1608:10: error: result of comparison of constant 23058430= 09213693945 with expression of type 'u32' (aka 'unsigned int') is always fa= lse [-Werror,-Wtautological-constant-out-of-range-compare] if (len > (SIZE_MAX - sizeof(*pg)) / (2 * sizeof(u32))) ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The code is correct anyway, so just shut up that warning. Fixes: 6f428df47dae ("libceph: pg_upmap[_items] infrastructure") Signed-off-by: Arnd Bergmann Reviewed-by: Justin Stitt Reviewed-by: Xiubo Li --- fs/ceph/snap.c | 2 +- net/ceph/osdmap.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index c65f2b202b2b..521507ea8260 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c @@ -374,7 +374,7 @@ static int build_snap_context(struct ceph_mds_client *m= dsc, =20 /* alloc new snap context */ err =3D -ENOMEM; - if (num > (SIZE_MAX - sizeof(*snapc)) / sizeof(u64)) + if ((size_t)num > (SIZE_MAX - sizeof(*snapc)) / sizeof(u64)) goto fail; snapc =3D ceph_create_snap_context(num, GFP_NOFS); if (!snapc) diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 295098873861..8e7cb2fde6f1 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -1438,7 +1438,7 @@ static struct ceph_pg_mapping *__decode_pg_temp(void = **p, void *end, ceph_decode_32_safe(p, end, len, e_inval); if (len =3D=3D 0 && incremental) return NULL; /* new_pg_temp: [] to remove */ - if (len > (SIZE_MAX - sizeof(*pg)) / sizeof(u32)) + if ((size_t)len > (SIZE_MAX - sizeof(*pg)) / sizeof(u32)) return ERR_PTR(-EINVAL); =20 ceph_decode_need(p, end, len * sizeof(u32), e_inval); @@ -1621,7 +1621,7 @@ static struct ceph_pg_mapping *__decode_pg_upmap_item= s(void **p, void *end, u32 len, i; =20 ceph_decode_32_safe(p, end, len, e_inval); - if (len > (SIZE_MAX - sizeof(*pg)) / (2 * sizeof(u32))) + if ((size_t)len > (SIZE_MAX - sizeof(*pg)) / (2 * sizeof(u32))) return ERR_PTR(-EINVAL); =20 ceph_decode_need(p, end, 2 * len * sizeof(u32), e_inval); --=20 2.39.2 From nobody Tue Feb 10 04:23:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD24512F38C; Thu, 28 Mar 2024 14:31:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636298; cv=none; b=N+ra2drUjO1JFuTUzygwQ6DTrQRi7jP6WELmDXs1gJrhOHy45/S5HFEwXspHbE0t+8sgmADfgEc1+9d9F5skzjVErzm98aFxTG13l4vcnv3uKJnPjL9U5VahiHOBEUOsUsUeoCkaXqvFg2mp/aFTVp13IgI3UxDUlywtHFNOBKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636298; c=relaxed/simple; bh=R0aUpIukgAH4xjGJj4S14g7ze9BAK3FgVk+vR41wWF4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QEmC9jXBCJyQ9lI45/Ccv0qcLLjcHuZjlI/QUCjOtFNpYh0/6n1RkT7lBtbfLxuKh25KOQXii7Hxl1U6e7rhzdSaBxmFPI5FeBvMCSAztmFcwfY/ro5wFo3mOicvmCroFmk3lmurJViTLv/y7rBg07wLskxLzrx8IPS99mWdVLE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y6nBMvO8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y6nBMvO8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56A6AC433C7; Thu, 28 Mar 2024 14:31:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711636298; bh=R0aUpIukgAH4xjGJj4S14g7ze9BAK3FgVk+vR41wWF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y6nBMvO8FUq7wwMpXlu5eU2X+qG2WwQMDrQQcRCXN13QGA7B+OYdbmM3DdmZbLfpd eJcJTquwgfzRZ2I0/ojf1S84gT5/H3gCLYVPq9jfRlj8k5y1H4wZpkhHcWXziQAml5 aJeSJ8DXrTbPoFJB3u+3Cyp9otY+hfgaiuBfkBGclsSwXDoAQXRuAEWvm5pvYnvJhS 0E6tdV7+RfopI4ZvIWUMm6IiTcdbMOVi9nncy4ueupamqPVOJxAgfXAN5H4zYM4HDo MuSfDfCP8h8W94vjEQL85zvUuRBzTmg9ZjMYK3/93ZDgIqf+rHpEjVsQ1kDiY5yHgD T6xlVNXKOCFgw== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Ilya Dryomov , Jens Axboe , Nathan Chancellor , Alex Elder , Josh Durgin Cc: Arnd Bergmann , Dongsheng Yang , Nick Desaulniers , Bill Wendling , Justin Stitt , Hannes Reinecke , Christian Brauner , Christophe JAILLET , "Ricardo B. Marliere" , Jinjie Ruan , Alex Elder , ceph-devel@vger.kernel.org, linux-block@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 3/9] rbd: avoid out-of-range warning Date: Thu, 28 Mar 2024 15:30:41 +0100 Message-Id: <20240328143051.1069575-4-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328143051.1069575-1-arnd@kernel.org> References: <20240328143051.1069575-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann clang-14 points out that the range check is always true on 64-bit architectures since a u32 is not greater than the allowed size: drivers/block/rbd.c:6079:17: error: result of comparison of constant 230584= 3009213693948 with expression of type 'u32' (aka 'unsigned int') is always = false [-Werror,-Wtautological-constant-out-of-range-compare] if (snap_count > (SIZE_MAX - sizeof (struct ceph_snap_context)) ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is harmless, so just change the type of the temporary to size_t to shut up that warning. Fixes: bb23e37acb2a ("rbd: refactor rbd_header_from_disk()") Signed-off-by: Arnd Bergmann --- drivers/block/rbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 26ff5cd2bf0a..cb25ee513ada 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -6062,7 +6062,7 @@ static int rbd_dev_v2_snap_context(struct rbd_device = *rbd_dev, void *p; void *end; u64 seq; - u32 snap_count; + size_t snap_count; struct ceph_snap_context *snapc; u32 i; =20 --=20 2.39.2 From nobody Tue Feb 10 04:23:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 780B412F598; Thu, 28 Mar 2024 14:31:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636305; cv=none; b=s38mZiZ3tW7fNQiTOYOW4VhvVMHsdmp3vpt/rKHC/kf4FsLknZwlxE+ScBoZ79PippCoGk1I75qO5lE6gv2Op24oIP/r0PJoTJdDRfS0iajH4IizdlWIGBAADRazxpWB5FzIc4cg7iGa5GeIc0un8UxcTXluZ5dfzbJ7ShbF76Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636305; c=relaxed/simple; bh=P6U94BE6FHCTdl/v1oN+gzg/0SGP34DXAEXihnAEO3I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=A1nUV+MAyRoF+QRv0JZ13Wa4NNOLxWvsYoe9Ll/vrTYcXX08ySADs9fgJFHdtW9hXTMtQ88jNxha7oscssneUTqSm8fca6/F1UH+CYuq0qlBYZjFTeHdoRGkcmtbZW1BS/7fzaxMwyYT1wMEHITctDlt6h6IJ+ReAc27eodp3hc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Dz5xPjEt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Dz5xPjEt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D19FC433F1; Thu, 28 Mar 2024 14:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711636305; bh=P6U94BE6FHCTdl/v1oN+gzg/0SGP34DXAEXihnAEO3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dz5xPjEt5VyYuoA/EUZ5hzXQNEmdtPQiJEPQIKiRkUOsl3dJ+VLdy8KmQi6j4VNH7 UyWLrfIqWtuEBxwj4eNtV0jHUM7jFg8diimwdcslOz2EbT3MRAfgmaEmwRuaY8ABGk 6kIR6c1mrdk4Vk2W9PxHF3EN/ZgpnM+JmelIXpvXSdIifuSMDlohPjCQ3NhDZ4/Gpz 1OA3c2Fmvv9eJVsH4ZuCZ7aX1gHKDPgc576+A8RORprUymUXmYkaQ8ZGglVC+gVJPC c5eKJCqL3pXda8JK1lqY94e+adEyykt962vJ5gWK/Vnp5Ei50ZuqULlKICze1BQtCk j62QouhM/AjHA== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Nathan Chancellor Cc: Arnd Bergmann , Dmitry Vyukov , Andrey Konovalov , Nick Desaulniers , Bill Wendling , Justin Stitt , Andrew Morton , kasan-dev@googlegroups.com, llvm@lists.linux.dev Subject: [PATCH 4/9] kcov: avoid clang out-of-range warning Date: Thu, 28 Mar 2024 15:30:42 +0100 Message-Id: <20240328143051.1069575-5-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328143051.1069575-1-arnd@kernel.org> References: <20240328143051.1069575-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann The area_size is never larger than the maximum on 64-bit architectutes: kernel/kcov.c:634:29: error: result of comparison of constant 1152921504606= 846975 with expression of type '__u32' (aka 'unsigned int') is always false= [-Werror,-Wtautological-constant-out-of-range-compare] if (remote_arg->area_size > LONG_MAX / sizeof(unsigned long= )) ~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The compiler can correctly optimize the check away and the code appears correct to me, so just add a cast to avoid the warning. Signed-off-by: Arnd Bergmann Reviewed-by: Justin Stitt --- kernel/kcov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/kcov.c b/kernel/kcov.c index f9ac2e9e460f..c3124f6d5536 100644 --- a/kernel/kcov.c +++ b/kernel/kcov.c @@ -627,7 +627,8 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigne= d int cmd, mode =3D kcov_get_mode(remote_arg->trace_mode); if (mode < 0) return mode; - if (remote_arg->area_size > LONG_MAX / sizeof(unsigned long)) + if ((unsigned long)remote_arg->area_size > + LONG_MAX / sizeof(unsigned long)) return -EINVAL; kcov->mode =3D mode; t->kcov =3D kcov; --=20 2.39.2 From nobody Tue Feb 10 04:23:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63D4612D209; Thu, 28 Mar 2024 14:31:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636313; cv=none; b=u9TkTQTKadAKw5YUhM3/ZuZELFGTh+e+Fz5LL9cR3wjDZy4WSrYhCTFP+PLl3mXpBqD41peDy87heqz0b4K3SKHZii6AV8C9cMNwhCosxeq+QzMR2C53nOAGB3GN6xOY8w8feKyBw3Y6jDhetrEbSsZK2SRqoU5jrFNBVPgDjuc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636313; c=relaxed/simple; bh=63E3lJn+RbWzhvFRPe7NeWgxZ0tEg6xP/LcfJ4ruTtU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YQWBsT1aUuYNNiZN6nfJ44ii5iCVrELo6R18lYFSyBEs0dvvy33MYGrlUxc7YPUlCqYwQx1IJ8Li558jXre3qbiTgvEKcINfjSHYmNjkaQFrD2pUZNrAJIqqXwXr3eem+VEz5dTHRCgUYzs+BkF2KkVq4bIQ9/QS3B7FMcgcp8Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IeIzeJPL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IeIzeJPL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73B14C433C7; Thu, 28 Mar 2024 14:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711636313; bh=63E3lJn+RbWzhvFRPe7NeWgxZ0tEg6xP/LcfJ4ruTtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IeIzeJPLkhJmIX8tfvNCyH/kz7dBZEaGv2AH5mRvXEHTKzjG/bGvkl1wrQQSGhHhR WAlroVk1KIkwQ+Q3j546UO8T09Xwgq/PY6cz6Ni1I+dxI3+5Qm72UOXucjukpc5yFH i41C1dQwmNLmjnPVXyDRWAY/cNcBJqm7V4Vmdqq8VtznuVDuRQKbNognTdbcoHH/dr DBEQCkj5UgVY9xr9OQxUF6szyNPMOywEknh4MEaqD+Su+pv3NDwx9F2ZS6Og5GR9aB analtJheeLW2+JVcuCKBt3GTI318iexloMXaM3CNcDQ9ZU4TbZBVBkGMfOCL0WXWSJ WJRJmX9ZP13/Q== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Eric Dumazet , "David S. Miller" , David Ahern , Jakub Kicinski , Paolo Abeni , Nathan Chancellor Cc: Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , Dmitry Safonov <0x7f454c46@gmail.com>, Neal Cardwell , "mfreemon@cloudflare.com" , Yan Zhai , netdev@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 5/9] ipv4: tcp_output: avoid warning about NET_ADD_STATS Date: Thu, 28 Mar 2024 15:30:43 +0100 Message-Id: <20240328143051.1069575-6-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328143051.1069575-1-arnd@kernel.org> References: <20240328143051.1069575-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann Clang warns about a range check in percpu_add_op() being impossible to hit for an u8 variable: net/ipv4/tcp_output.c:188:3: error: result of comparison of constant -1 wit= h expression of type 'u8' (aka 'unsigned char') is always false [-Werror,-W= tautological-constant-out-of-range-compare] NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPACKCOMPRESSED, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/net/ip.h:291:41: note: expanded from macro 'NET_ADD_STATS' #define NET_ADD_STATS(net, field, adnd) SNMP_ADD_STATS((net)->mib.net_stat= istics, field, adnd) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~ include/net/snmp.h:143:4: note: expanded from macro 'SNMP_ADD_STATS' this_cpu_add(mib->mibs[field], addend) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/percpu-defs.h:509:33: note: expanded from macro 'this_cpu_add' #define this_cpu_add(pcp, val) __pcpu_size_call(this_cpu_add_, pc= p, val) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=3D0 = to see all) :187:1: note: expanded from here this_cpu_add_8 ^ arch/x86/include/asm/percpu.h:326:35: note: expanded from macro 'this_cpu_a= dd_8' #define this_cpu_add_8(pcp, val) percpu_add_op(8, volatile,= (pcp), val) ^~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~ arch/x86/include/asm/percpu.h:127:31: note: expanded from macro 'percpu_add= _op' ((val) =3D=3D 1 || (val) =3D=3D -1)) ? = \ ~~~~~ ^ ~~ Avoid this warning with a cast to a signed 'int'. Signed-off-by: Arnd Bergmann --- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index e3167ad96567..dbe54fceee08 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -183,7 +183,7 @@ static inline void tcp_event_ack_sent(struct sock *sk, = u32 rcv_nxt) =20 if (unlikely(tp->compressed_ack)) { NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPACKCOMPRESSED, - tp->compressed_ack); + (int)tp->compressed_ack); tp->compressed_ack =3D 0; if (hrtimer_try_to_cancel(&tp->compressed_ack_timer) =3D=3D 1) __sock_put(sk); --=20 2.39.2 From nobody Tue Feb 10 04:23:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8A62130E45; Thu, 28 Mar 2024 14:32:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636320; cv=none; b=D+dT1TUN4HfcfLaedb4L3Hm0NXxqJkZyC69qaF01gV1/JaMi+Pd1abMZDe5qy7tlK+cfKxLQmxDLkaWwMXLYWQ9FmHKTgE7V1MdpZ5j547Ty1aC5tTKeeQlS0zyJ277jJIBjWolGkifOaRsHKgmGrS/m1h32dB07BrH5WVeidm8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636320; c=relaxed/simple; bh=bQir+LnXysAhPZ396iMcqboZJXRv11Qwf6prsi0Igo8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tNOUi/TzKrMCQ7w9BMx05VwdgguSWHpqbnUPnrbRFB5DhPvXLiR3oAjwrku8qvYw88DxxoqF4xbBdhHDZhGx4w4yCn6bjOkNTsETH4G7oLgVx4epKzEA98f1g2D5a1Qp0eL4u7jP7iiV2ZT2eg4D3fS5MpZTq/8mpbGyPh7Ggl8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=liAm5gps; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="liAm5gps" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A30DC433F1; Thu, 28 Mar 2024 14:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711636320; bh=bQir+LnXysAhPZ396iMcqboZJXRv11Qwf6prsi0Igo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=liAm5gpsUU3TfhVsQ0ds/wY4LTN/URRYHe8wfWIMPMwve7nP8Tx0ppkFakNHWeFoG G9zUo7Xb9xSrzVNuWGM6AmS9LJ2h7SA/YK890UR7pm3ZCL3iHJ5ytr2vILOXZc6Pvy IvTi01GNrvQjFvVdEa+BmDvmrxSqIPitR/WoSyv5ZC9JVGWvwDMm8EhrwbnA+2esr4 8l0MIBo6tv0tvEFirVLddDTLvk+QRRamCltTRizGF5UEIXY7QpWF4mIpjgP2DEun7P zHwDYRs3rRoeSuUOXdxp4i5a2hYw29lh/0tbRmGPW4DyLFW/PfoBf8fsaSzyZRi+S7 jHCOTMtOeo9kQ== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Ryusuke Konishi , Nathan Chancellor Cc: Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , Andrew Morton , Philipp Stanner , Christian Brauner , Jeff Layton , Thorsten Blum , linux-nilfs@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 6/9] nilfs2: fix out-of-range warning Date: Thu, 28 Mar 2024 15:30:44 +0100 Message-Id: <20240328143051.1069575-7-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328143051.1069575-1-arnd@kernel.org> References: <20240328143051.1069575-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann clang-14 points out that v_size is always smaller than a 64KB page size if that is configured by the CPU architecture: fs/nilfs2/ioctl.c:63:19: error: result of comparison of constant 65536 with= expression of type '__u16' (aka 'unsigned short') is always false [-Werror= ,-Wtautological-constant-out-of-range-compare] if (argv->v_size > PAGE_SIZE) ~~~~~~~~~~~~ ^ ~~~~~~~~~ This is ok, so just shut up that warning with a cast. Signed-off-by: Arnd Bergmann Acked-by: Ryusuke Konishi Reviewed-by: Justin Stitt --- fs/nilfs2/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index f1a01c191cf5..8be471ce4f19 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c @@ -60,7 +60,7 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs, if (argv->v_nmembs =3D=3D 0) return 0; =20 - if (argv->v_size > PAGE_SIZE) + if ((size_t)argv->v_size > PAGE_SIZE) return -EINVAL; =20 /* --=20 2.39.2 From nobody Tue Feb 10 04:23:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36C6112EBC3; Thu, 28 Mar 2024 14:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636328; cv=none; b=CI6JyHWPs7c6EUY7d1gfUKdtOz93HQxy3IXBMd41Cb32lfEbCcxLLExpiebbcn+DQrvDZMdMlStclx1cPh3k7EqnLQyVPW///uZpjGpmofp3iNZD7VBtNRso6o0wWnbj72LDc0UfvcFAu7PYeiQB8bgyHb5yPXF/epdg+3TbmIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636328; c=relaxed/simple; bh=5/qbxUkF4XswjPzTkOHdQkkFpw7qxD+eOfPSj/d7hr4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=m4a7n+UKtvSLhlhVFBrx5upet8qpSctGA+/efERpYQGd6VGSVbDXLmDBsAo4UvzfQotKIydnBFz/3u4OJwQdYanQhwfWIJOJyIR3a6K3rWLeWcRlICALfXNoo2v+cLrc3jRu5xVaITfNRUFKJPbzVLK2maVR94JC//g31ryYlF4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WanTW1Lx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WanTW1Lx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37564C433C7; Thu, 28 Mar 2024 14:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711636327; bh=5/qbxUkF4XswjPzTkOHdQkkFpw7qxD+eOfPSj/d7hr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WanTW1LxmCiyp25kaYKbNaTCXXDTjSDownunWR9JZmRwCTDNGNQxSdcnN1xIHNJSo L3iz0NAMG51wKLLXAlB1NEoMc2VAFg39cTLa913tDH1T7eeD2GRVJ4Z+0XsQ4WJSsY 660ztX8dQxR2cUwhRiT/l/cnSgF4JNtWwG1w9ZFzZe5w2BTNo0c1tVmwOmnH3Dnj2d x1ut9KB1UHF61fzwASMGFwpRm0+BHMHInvkysZnnPuxhZ6qHDwC2L/S/wFzEJzWpd9 pCH3aAxaKW2O4hhYvNdWZV95xXK6FFGhvvuqOVqVJi38rornVhrtKjryCxqQ/fhdNQ NIHFYujkzPDtw== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Jason Gunthorpe , Leon Romanovsky , Nathan Chancellor Cc: Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , Kees Cook , "Gustavo A. R. Silva" , linux-rdma@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 7/9] infiniband: uverbs: avoid out-of-range warnings Date: Thu, 28 Mar 2024 15:30:45 +0100 Message-Id: <20240328143051.1069575-8-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328143051.1069575-1-arnd@kernel.org> References: <20240328143051.1069575-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann clang warns for comparisons that are always true, which is the case for these two page size checks on architectures with 64KB pages: drivers/infiniband/core/uverbs_ioctl.c:90:39: error: result of comparison o= f constant 65536 with expression of type 'u16' (aka 'unsigned short') is al= ways false [-Werror,-Wtautological-constant-out-of-range-compare] WARN_ON_ONCE(method_elm->bundle_size > PAGE_SIZE); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~ include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE' int __ret_warn_on =3D !!(condition); \ ^~~~~~~~~ drivers/infiniband/core/uverbs_ioctl.c:621:17: error: result of comparison = of constant 65536 with expression of type '__u16' (aka 'unsigned short') is= always false [-Werror,-Wtautological-constant-out-of-range-compare] if (hdr.length > PAGE_SIZE || ~~~~~~~~~~ ^ ~~~~~~~~~ Add a cast to u32 in both cases, so it never warns about this. Signed-off-by: Arnd Bergmann Reviewed-by: Justin Stitt --- drivers/infiniband/core/uverbs_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/uverbs_ioctl.c b/drivers/infiniband/co= re/uverbs_ioctl.c index f80da6a67e24..e0cc3ddae71b 100644 --- a/drivers/infiniband/core/uverbs_ioctl.c +++ b/drivers/infiniband/core/uverbs_ioctl.c @@ -90,7 +90,7 @@ void uapi_compute_bundle_size(struct uverbs_api_ioctl_met= hod *method_elm, ALIGN(bundle_size + 256, sizeof(*pbundle->internal_buffer)); =20 /* Do not want order-2 allocations for this. */ - WARN_ON_ONCE(method_elm->bundle_size > PAGE_SIZE); + WARN_ON_ONCE((u32)method_elm->bundle_size > PAGE_SIZE); } =20 /** @@ -636,7 +636,7 @@ long ib_uverbs_ioctl(struct file *filp, unsigned int cm= d, unsigned long arg) if (err) return -EFAULT; =20 - if (hdr.length > PAGE_SIZE || + if ((u32)hdr.length > PAGE_SIZE || hdr.length !=3D struct_size(&hdr, attrs, hdr.num_attrs)) return -EINVAL; =20 --=20 2.39.2 From nobody Tue Feb 10 04:23:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F9B712BEA0; Thu, 28 Mar 2024 14:32:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636336; cv=none; b=r6jlSDlIp2kjm3+3yyYrk5/Kfj30PKkooy1wya/QS20+16jt8vfjedyH7VWaJpfQoVv3g7COtmnvmTfDX0qMYUakvL5LbiZUdaykOdPWrNdWxOwlM6C89qrBwTAXSixSWTbCXZM9Pe35DsBeItRa91KyIz6l8ZSuar3xvCfKVCo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636336; c=relaxed/simple; bh=oOMLQx+gPaXHH5Tk6o+DNZIrvqEEtpFNuWMdgsGdvoY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R2V28Mqe7RAhA0iJzGNNSU4GZEsZRo0w7C0YVELohycv94O7Scvj5KAXj9p0VoatgeNpat9PDsJdAEQABWRonMJUTgl0j6KGbsO3iazTruqC1wwTXAI8Jtv0nV6ZQTUd7/uvWQ8sfGAvTaYTuNoIcJa1kAcs7XFy6Kps1Cy/MNA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rwlsvkhH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rwlsvkhH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CBF9C433C7; Thu, 28 Mar 2024 14:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711636336; bh=oOMLQx+gPaXHH5Tk6o+DNZIrvqEEtpFNuWMdgsGdvoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rwlsvkhHCsWSQWHVw/27w1M7pS1Z3C3fvOkjQZto5XbtiZvBzheadtKt4qSt9CO53 BRkZ1E9up6qBgTfor+rcxdIc0tpi08tqJfhHIhvDMK2F9Uzd/A44Xm5N1CZ4AtzNOw M31LEk8eYkBTzX6NzeKe8UsHOGHu8oSP48s0psUqL7RdUe32N+QrfOvA+wzOxn/z6x bGGtaUBNb3NdDlOlch3dTNKM8l8KiK4VVMjjnnVnLeXTYPetOdxgDP5WwxSLNecWsh TLngdvzP4KMTHREfE0HPuRvpbwwU8jiF0Jk67qcQrAliZbIH+7w3RMZduND8EqkBUz V3dj+E+ST0j6w== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nathan Chancellor , Jonathan Lemon , Maxim Mikityanskiy , Daniel Borkmann Cc: Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , Tariq Toukan , Gal Pressman , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 8/9] mlx5: stop warning for 64KB pages Date: Thu, 28 Mar 2024 15:30:46 +0100 Message-Id: <20240328143051.1069575-9-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328143051.1069575-1-arnd@kernel.org> References: <20240328143051.1069575-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann When building with 64KB pages, clang points out that xsk->chunk_size can never be PAGE_SIZE: drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c:19:22: error: result= of comparison of constant 65536 with expression of type 'u16' (aka 'unsign= ed short') is always false [-Werror,-Wtautological-constant-out-of-range-co= mpare] if (xsk->chunk_size > PAGE_SIZE || ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~ In older versions of this code, using PAGE_SIZE was the only possibility, so this would have never worked on 64KB page kernels, but the patch apparently did not address this case completely. As Maxim Mikityanskiy suggested, 64KB chunks are really not all that useful, so just shut up the warning by adding a cast. Fixes: 282c0c798f8e ("net/mlx5e: Allow XSK frames smaller than a page") Link: https://lore.kernel.org/netdev/20211013150232.2942146-1-arnd@kernel.o= rg/ Link: https://lore.kernel.org/lkml/a7b27541-0ebb-4f2d-bd06-270a4d404613@app= .fastmail.com/ Signed-off-by: Arnd Bergmann Acked-by: Maxim Mikityanskiy Reviewed-by: Justin Stitt Reviewed-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c b/drive= rs/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c index 06592b9f0424..9240cfe25d10 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c @@ -28,8 +28,10 @@ bool mlx5e_validate_xsk_param(struct mlx5e_params *param= s, struct mlx5e_xsk_param *xsk, struct mlx5_core_dev *mdev) { - /* AF_XDP doesn't support frames larger than PAGE_SIZE. */ - if (xsk->chunk_size > PAGE_SIZE || xsk->chunk_size < MLX5E_MIN_XSK_CHUNK_= SIZE) { + /* AF_XDP doesn't support frames larger than PAGE_SIZE, + * and xsk->chunk_size is limited to 65535 bytes. + */ + if ((size_t)xsk->chunk_size > PAGE_SIZE || xsk->chunk_size < MLX5E_MIN_XS= K_CHUNK_SIZE) { mlx5_core_err(mdev, "XSK chunk size %u out of bounds [%u, %lu]\n", xsk->= chunk_size, MLX5E_MIN_XSK_CHUNK_SIZE, PAGE_SIZE); return false; --=20 2.39.2 From nobody Tue Feb 10 04:23:42 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 431781272CA; Thu, 28 Mar 2024 14:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636344; cv=none; b=dWJDCxqi79oCTy96xHRbXOCmfB7f4J0Oghut52JeFYkzaNzjXJ+Aw41A7uJLny1kPb6s1SdSi+S1VYKcoMIod1Y0YD18owHLzS81BeYKXM2S6+XXxo2rTA+ShGnSsQUoUju8PHp9nEVvxCUIrGJ0NVD1asI+zyccenfaZbSsH4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711636344; c=relaxed/simple; bh=FdkOG4zdDjfUSDCk/3pUequwdZ6ldgpgrBgA4ee4qCc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cdopvFx1ewITM12SM3O1tiSUG0oLTHfEJoP2e3LSFSVDdkRGWs/oHNWne8t7ZusdyvaKYIgWcYanX5bqO/bgfynkOOm+A5o/VHc5crQVkzXShQEJIbP2e4wdZrZS1kdCKT2A22W6+yhGJGE2xVDpMgu2HAGtfdXDCTbSMt9OW2c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d48G4MJ2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="d48G4MJ2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8BC2C43390; Thu, 28 Mar 2024 14:32:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711636344; bh=FdkOG4zdDjfUSDCk/3pUequwdZ6ldgpgrBgA4ee4qCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d48G4MJ2rq1yUfCDNrKx49TagncZz3YBLM9fG5XHBkUnIOTb4XC7MeAMzcsqvkwrO 1xlQPYCbLww38b5697nr/jq4Hl1vsgecl1mf8B5psa64ZyNJtRhVDf7OGcbtMmn+k9 YgN9X3T98oGYTrQcbz8CKlkJyb+KojNTTexy0bt4PONp0AtvskeOFtzaS3mqGBvTX/ m3B1XPzXlSSveOt3PPUHLK0KF+VsBRWjMETAGYkAc4fObGkvAI+J3r2Yk8ASFakNK/ 2YWagsHEplLZWUgrHCNzyhvam4YWuCAS7nvdC62b+7bib/ot1IgCmNRpJ20KE39ulv ESPzdIf6v1OlQ== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Masahiro Yamada Cc: Arnd Bergmann , Nathan Chancellor , Nicolas Schier , linux-kbuild@vger.kernel.org Subject: [PATCH 9/9] kbuild: enable tautological-constant-out-of-range-compare Date: Thu, 28 Mar 2024 15:30:47 +0100 Message-Id: <20240328143051.1069575-10-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240328143051.1069575-1-arnd@kernel.org> References: <20240328143051.1069575-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann All the previously reported warnings from this option have been addressed, so the option can now be left default-enabled, rather than disabled without W=3D1. There are not too many actual bugs found by this, but it can help detect a silly mistake earlier, and it's usually trivial to work around the false-positives. Signed-off-by: Arnd Bergmann --- scripts/Makefile.extrawarn | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 5a25f133d0e9..24d29e477644 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -120,7 +120,6 @@ KBUILD_CFLAGS +=3D -Wformat-insufficient-args endif endif KBUILD_CFLAGS +=3D $(call cc-disable-warning, pointer-to-enum-cast) -KBUILD_CFLAGS +=3D -Wno-tautological-constant-out-of-range-compare KBUILD_CFLAGS +=3D $(call cc-disable-warning, unaligned-access) KBUILD_CFLAGS +=3D -Wno-enum-compare-conditional KBUILD_CFLAGS +=3D -Wno-enum-enum-conversion --=20 2.39.2