From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.169 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796129215; b=w4M+qtBFGUeJTo9KvscozT3XZ00k8rYxAXQaT+GLdcLv+pRWu/5LaVZnPgA/grB9yBuj CjuI6vwNim0Ywt9NVm2YDYSi0C/OP7Ztz2GZzBgi7og0nvqxsYYNe0A1VjilH+tdFu2kL neHe9iucduUd5zV7fnPL98qWe5wfEk5vCPSo/eDfnuHd20+GcfDgVAW4rYbt558wHpdbg WoC/2MA5nNCldz8UhCiW5iNtii/hNuTWCjJb7bNkmRY23eoNa4TLD9qMIcm5YiAra2cup E2YDWRJuhba1Vyoc3Iy2OsLMtjXk8dyajJOoolck2T4PQC/Z5aKazlytVBfNg3Dh9Cg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796129215; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=ReLecVB9PPGh/YUSW0awC5as61vVcIF8LBLH0NW98rQ=; b=tdXhC+c/OWpG8xvNFIEJIDTggRNzu+F46IjFb4O9tYDakG619ajeM83F1oWO/G9LZm4f dXWVWniY7cQe/m33DqSOTc+9+3+cVJNBLcelZMVRitaocFBJQzQK9Koo37EalmcFsmdcM 1nGdsWCAb6bDDgDVdXl8UFcwFmzX8840H1QJd+cP2o7x5dSFrF95Qrtg8V5ADZnUIDOxU FjkywkMmGC1PFT9QzRdbDXgbH9r3z7T0KPAGeQIGj5aOkNBzFORE2rqd6SGGj9f+l6/Mt YlqZaellYQCp9A9yLkTCttKTbOu73bwG/SNcZ3hnXubHuaIcXRsBSrxjG55udqQDhnQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=dxyYPQ5p; arc=none smtp.remote-ip=209.85.160.169 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6CF8606A685 for ; Tue, 1 Dec 2026 12:46:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C6CF8606A685 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=dxyYPQ5p Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-5365f9a04c5so112486491cf.1 for ; Tue, 01 Dec 2026 04:46:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796129203; x=1796734003; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ReLecVB9PPGh/YUSW0awC5as61vVcIF8LBLH0NW98rQ=; b=dxyYPQ5pwoH4beIQtuLqEd7QvO4rvoKQzK7Rojd4CqB8jJz7WVCku5hbQOoMZpoXvd Mzzeqk5Q0lnXeTZIDsJ/O3kMcohuINKwhJ8A+GR5o4XwUqksU0U9sPHrvnPQ0uOLOkEo ETrf9W3SkCPlYVUv4ple7+XorI4GxykLAHENgwLqXvcand7IHN7m440uVPUbn+vF6km6 ZVlOwEbDRAZR3vqjWoAtcxtXODc/wDrt776ZzfzkD4WOAMUyZuWKvlQqnCJzNq6upNHY a5fCCIjtOQ2QHn9Scm9h8pLAY5LvJi0wLHHoH+C4WSnBx1E/eJ2t67f83pOBK1UUZq/t PPkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796129203; x=1796734003; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=ReLecVB9PPGh/YUSW0awC5as61vVcIF8LBLH0NW98rQ=; b=2CLz1SF8/0sghghy36aaVkPZjpG4aeOm3XQ01DIWI/xEK30D48euCtYxHHt0Xu07o+ wGG7HsEqprMTkvl0ZNbefZ1FG0XQ/57vFQyJ2RS+Z98ZQWoTDXhG+WyYw5Xm74lsnFgQ mayGgqk9CtddILkU/RurgiIUlcLAZDdtsAjKgjlOy5Z7xpMuwlPjRvjmdHxBopbjxD2f xwJzssMi0oravvU7r3akQBqMkBIJAtcet0jtqhgvTS/7CRceREjJojSMhR3BE7svF5fc nwvXSnuQLKexqBUuHbxLVV4bK/B98pOSwQhqhMaovWn+083+a7Gm25WrVuW8oKpT090Y +tow== X-Forwarded-Encrypted: i=1; AL+hErGv3IvBsTCk/MwI382fI5RMmINpNnekwv+Nlv0cIau0dzD7ZHNQDZhbEoUMRu4zaYV1CGEd8QUEYXClHgM=@vger.kernel.org X-Gm-Message-State: APuU4Z9vqqG5rOyCkWR+KKBUhZkG8sr9F/gXUy946cERnrL8l3OOtLCM py+4Qyy9wNpgCeLV9x9ftjcKx278HMjsV0IoDQr4oo9JVFTdwx/spxK5ApqBMKpQXn0= X-Gm-Gg: AZFdTZfi62YzwoPjnzM5WxAuoRY8m8IrC21z6LBHXveaZv3JS3jwqgF+hbNtBgu32gX ZKqjtoAW2Ey0HWCDju5D1o7R3CmkahaLw6oyrydYIunnGuCk8166kYgo2ZI2FwdmaUJHo1zFeM8 ZsoP2pNr0SI+4KGa6e4BptDQlq7f+9FYdWBuv6VNFqVZakugyMqUOx4UaZxKjUcE+imnNCTTVDQ fyB+tylmW+7HB0vyxcDTDNAX1fHwiCLNu14ZVYNvKLTmFGf8zeVb2EznFN4n7raWUO6UvqiCGf6 p/AmdLU0mInkfWlIOgHsnD2AQt7VSzcTW+j1qczb/G3KJ571EJT5/XQqlNk9b7h6FdUPjp4qx8s xy9aNEKEzA1Lle+C8B4ljKng1t8extN3e5Clgw5HwRMBeOwPI7C5yNiI2+RNfSjAHBAg1Su3UKu qF4u/iif6+ZR/Gx3HmVK2mjviHEQSf2/wNSH6cxWH/cArqoFpzPVNtgwWJpYTZnb6HDApZNAc00 5a/cwAcgPb70ePkYS49R2+DRkMKVIFwaBcKFxo55fFiC3suag2Zs4NaOmUrgf3JYuij2UAkTY1x 8sipA8V84uLEjq7stzMyrwzB4I+Wp1FFiwV7Vz6iJIxVMC/MWnOWmmWTZ9s460fx6wfWk4HjE8O tjDYh/xfw5/+PtA72a0BLy3ht/Sc+JB6/P6t8yjtxIqj1XTDZm3v3GEbIaTo0qgXvl0/vWpG/yW O1/bvfZKUDRB5lj6DTNa3FwwhvKyig1pyhle5fMCPSAyyibZmxzuMD/dqiJwUbMXbfctNsP5WeY 3/ptxFEOy9QARPkg5TAZ3o++T4tNAkAhlQbuhNWPzqWhN78PwVIkPylz9VcG0mTltIqGWKIILuO Efar X-Received: by 2002:ac8:6545:0:b0:55d:366f:7cf6 with SMTP id d75a77b69052e-55d76a40217mr698114191cf.28.1796129202767; Tue, 01 Dec 2026 04:46:42 -0800 (PST) Received: from localhost.localdomain (static-23-234-123-69.cust.tzulo.com. [23.234.123.69]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d78e4fc12sm306148361cf.0.2026.12.01.04.46.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 01 Dec 2026 04:46:42 -0800 (PST) From: Joel Cruz Cabrera To: akpm@linux-foundation.org Cc: tpiepho@gmail.com, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] math: rational: add a KUnit case for a semi-convergent term above LONG_MAX Date: Tue, 1 Dec 2026 12:46:34 +0000 Message-ID: <20261201124634.48970-2-tf.joel.work@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20261201124634.48970-1-tf.joel.work@gmail.com> References: <20261201124634.48970-1-tf.joel.work@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a case where the best semi-convergent term is ULONG_MAX - 1, which made "2u * t" overflow before the previous patch: for 1/ULONG_MAX with max_denominator = ULONG_MAX - 1, the closest fraction is 1/(ULONG_MAX - 1), not 0/1. The case is written with ULONG_MAX so that it covers both 32-bit and 64-bit kernels. This test was written with the help of an AI assistant (Claude, by Anthropic); I reviewed it. Signed-off-by: Joel Cruz Cabrera --- lib/math/tests/rational_kunit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/math/tests/rational_kunit.c b/lib/math/tests/rational_kunit.c index 47486a95f..c8dac1904 100644 --- a/lib/math/tests/rational_kunit.c +++ b/lib/math/tests/rational_kunit.c @@ -2,6 +2,7 @@ #include +#include #include struct rational_test_param { @@ -21,6 +22,8 @@ static const struct rational_test_param test_parameters[] = { { 1155, 7735, 255, 255, 33, 221, "Exact answer" }, { 87, 32, 70, 32, 68, 25, "Semiconvergent, numerator limit" }, { 14533, 4626, 15000, 2400, 7433, 2366, "Semiconvergent, denominator limit" }, + { 1, ULONG_MAX, ULONG_MAX, ULONG_MAX - 1, 1, ULONG_MAX - 1, + "Semiconvergent, term above LONG_MAX" }, }; static void get_desc(const struct rational_test_param *param, char *desc) -- 2.50.1 (Apple Git-155)