From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 9200119E992; Thu, 20 Aug 2026 17:53:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787248390; cv=none; b=S/Nzf07UDA94l3AyDuu0oFfkPXPn5ZlmFbhq26+XqNPPVwyXz/kxWGqtw42xzem3+tDQjnasTBAqvv3KjGSyCbDCZfvGlcDqeQsYDrdKOQMDaSk51y6Rn9z/W3+IYnN5w2xnCjVn7yi/7hr32tIo5cMAuMxBrtQoYccgYZwyhyo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787248390; c=relaxed/simple; bh=xEBnzK/NXJEFb3V0+YPguHZRlFEUHhmcPRmuBnmOG8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NlXvdwmuu9crApqSduvRAznep9NOsZudqlWqPKglKRvo2xU0BBpwvKihGSpMVB2lPiDrM06aMv8LSvCzycqLU8bkQvfNJZHvnRbfq7fs5UWeI4WO6OkoP04+CbsOerTz0XY/JzfOkou9+PbCAs6dNEnSaBSLmB7L7joR9WC0dFE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=X7NfF0te; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="X7NfF0te" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE1571F000E9; Thu, 20 Aug 2026 17:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787248389; bh=ZbZTF4m2h3D6+SlGfhHPOHdIk6367yXafQSSnaTJgYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=X7NfF0tevXnlFsiqB4dHff/2i4DXERwFR4d/bQN6QKcajaVAvy3cM74QS92oz/DYb GkOVEkrfEgQgN7e7J2S68EjjgoTdc0o3Wum8vpt+AKOzWmjR2D9YX8wrG3fRxJH1BK 7TKk5Qm1SFXW45XfeqbmXCpbTl0DopTRa55hjJO4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andy Shevchenko , Viacheslav Dubeyko , Ilya Dryomov , Sasha Levin Subject: [PATCH 6.1 211/303] libceph: Amend checking to fix `make W=1` build breakage Date: Thu, 20 Aug 2026 16:55:47 +0200 Message-ID: <20260820145259.736012276@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145253.200766705@linuxfoundation.org> References: <20260820145253.200766705@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andy Shevchenko [ Upstream commit 04d8712b079327409b09dee628378f9583e2e035 ] In a few cases the code compares 32-bit value to a SIZE_MAX derived constant which is much higher than that value on 64-bit platforms, Clang, in particular, is not happy about this net/ceph/osdmap.c:1441:10: error: result of comparison of constant 4611686018427387891 with expression of type 'u32' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] 1441 | if (len > (SIZE_MAX - sizeof(*pg)) / sizeof(u32)) | ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/ceph/osdmap.c:1624:10: error: result of comparison of constant 2305843009213693945 with expression of type 'u32' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] 1624 | if (len > (SIZE_MAX - sizeof(*pg)) / (2 * sizeof(u32))) | ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix this by casting to size_t. Note, that possible replacement of SIZE_MAX by U32_MAX may lead to the behaviour changes on the corner cases. Signed-off-by: Andy Shevchenko Reviewed-by: Viacheslav Dubeyko Signed-off-by: Ilya Dryomov Stable-dep-of: 9f00f9cf2be2 ("libceph: bound pg_{temp,upmap,upmap_items} length to CEPH_PG_MAX_SIZE") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/ceph/osdmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -1440,7 +1440,7 @@ static struct ceph_pg_mapping *__decode_ ceph_decode_32_safe(p, end, len, e_inval); if (len == 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); ceph_decode_need(p, end, len * sizeof(u32), e_inval); @@ -1621,7 +1621,7 @@ static struct ceph_pg_mapping *__decode_ u32 len, i; 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); ceph_decode_need(p, end, 2 * len * sizeof(u32), e_inval);