Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4823980pxj; Tue, 25 May 2021 18:01:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIg/bIvhgNqbGkUrNu2f84JJFUYZ2UHx+0ySz4l8D8njtRwJgcr4n1dyPOu4PfSwNOzxmG X-Received: by 2002:a05:6602:2bef:: with SMTP id d15mr23893017ioy.13.1621990904679; Tue, 25 May 2021 18:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621990904; cv=none; d=google.com; s=arc-20160816; b=c+LuZRSMGq48gXOCpM8LpwKn1OKfdhaTxa98/YOAwsN+8NgqCh/4/b2E5UoICe+sA+ 2+p0iQ8MMs5LkBxxQ9MBr38Uk39s2fbxJhc+jgab07f+/yDwmJGAtHcBEELQaGd7gBuZ 71F6ogJWf9ya/VdnSg6rQcRrYIF0E891wBENAv1TosiAVZXqmoX7ry0ZZsLHI9305Ocl Vw0LTINYA5ewn/QVqOitwXEqWb73fjrNtfdB0HnuiJtk/9+jX+6sEhFQBnvxsn8UAnbq MM03R55gNL9LxeUfSDyhEHm4WQeeFVQQ4QG+gy9SNS2oNpdKtJmQ9GRTZ7y8yeWY+JYA cXlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=VqUUs/J+2YxwcVoe+boIpc83NSWpfONtjDqPEhIMgEo=; b=BqHDGwpeWijgl+cZrLEOGoLmj5w3rUfh6BM28LzUsRe1Pa/VKE0waDrd5pa5UnHXRG yulWaz4Vr23Wssr8JzsB+tFUphUlHKZFwghKJAukGnZ2qjBfqC88QzTF805/zxGM4ko3 cHQxWla0jAswg5vTEKZORvJOENJj1DIYBWt2/RgZwUBuT6PNvGE7bh8wJyf0G0c290an ug+v7yMAjBK5bkcIjvjzsPQiMaLfgLwfA3aEPDQC93gtt3twH5bT7mpB2ObqwgtxKsft 4vGi6Tj6chnm5zjf4cA3G5qCmFdsGYjmdYALRbXShJCoBBSPSqLHSKm3rOdttnRU3F0g JtRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=UFvh6wek; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m25si18549353ioo.79.2021.05.25.18.01.18; Tue, 25 May 2021 18:01:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=UFvh6wek; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233501AbhEYVsb (ORCPT + 99 others); Tue, 25 May 2021 17:48:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:50332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbhEYVs0 (ORCPT ); Tue, 25 May 2021 17:48:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 74B4E613CC; Tue, 25 May 2021 21:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1621979215; bh=rMjDKhEBpaXg2FGIeyQojtDCfZ0+6jZ1tqyvpj3OmLY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UFvh6wekkkcPJFxCYY+fE0xmJQh02ILWsv0jukXePsFCoM0XNqg3tTynxLNTA6L/2 0fDIwK6Bx8T2ZW7DyphkyOgqRsQyHZZBaPBBojxSoTE9TZ+Q+/CqzdkJi00dw/vHwj 4LNeEBy2g6UdcCdf9/JkZyKTEH0V1nVZu8QZmHYk= Date: Tue, 25 May 2021 14:46:54 -0700 From: Andrew Morton To: Trent Piepho Cc: linux-kernel@vger.kernel.org, andy@kernel.org, oskar@scara.com, Daniel Latypov , Yiyuan Guo Subject: Re: [PATCH v2 1/2] lib/math/rational.c: Fix divide by zero Message-Id: <20210525144654.e41cb942a2804d08127ad48f@linux-foundation.org> In-Reply-To: <20210525144250.214670-1-tpiepho@gmail.com> References: <20210525144250.214670-1-tpiepho@gmail.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 25 May 2021 07:42:49 -0700 Trent Piepho wrote: > If the input is out of the range of the allowed values, either larger > than the largest value or closer to zero than the smallest non-zero > allowed value, then a division by zero would occur. > > In the case of input too large, the division by zero will occur on the > first iteration. The best result (largest allowed value) will be found > by always choosing the semi-convergent and excluding the denominator > based limit when finding it. > > In the case of the input too small, the division by zero will occur on > the second iteration. The numerator based semi-convergent should not be > calculated to avoid the division by zero. But the semi-convergent vs > previous convergent test is still needed, which effectively chooses > between 0 (the previous convergent) vs the smallest allowed fraction > (best semi-convergent) as the result. Is there any known userspace workload which can trigger this? IOW, should it be backported into -stable and fast-tracked into 5.13 or will a 5.14 merge suffice?