Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5044737pxj; Wed, 26 May 2021 01:11:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBTcOW37olSnnA3w2gM8cYypfIqZekCgXV0y4byyYEgOLtkLovyhiorOjZYmVBJyw6rAx6 X-Received: by 2002:a17:907:d03:: with SMTP id gn3mr32819435ejc.476.1622016710820; Wed, 26 May 2021 01:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622016710; cv=none; d=google.com; s=arc-20160816; b=mps0K48fgze9les+GkziBFFJ3HkTf5S8TOQL4tVjwOSwbn6ZdiZCk4B1gmgpxjux8d b1vR82OOJsS0W0IXaoqpfAePHBHjocy3b1kKghXm/lYVHPC/TB7oKEGMY2oHHzO8vLF4 Qns5Iq+BH4D1MVVD9+oCRdOL8TELWA9IkzSFvT86SbAtF4C+PWfW8VY3MItpJ+ie67RZ 2KPButKEviTInJkz1fY25pkHc6BPq6NsoDmEjsrzu4NhGAHkdFz0ci8QArX2L2On87B+ 5Mat+lQIfRPYDvNPpGdWQabzVjvSRFhl38Vi5G9nWkoaZtnj6OvU86HtRrrr95xLGnkV 8O2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=O1qrD3MSpVMvikbxFUM8PcXtyggq9QQWrTX5C5Xl/ok=; b=qBG+9D/TMBnY9qon7Tv2T3eNOzkTWNC93oljNbzkDa5lR/tPnLZU8o+6RwbwJoLBUg kBz7Yb1WvekN7OgfprkikPXh7m2U7WYdzfkubbaXkHyPmPtEiYvmx49Gdxh+U1NdtsX/ 7XjejzqTTDwtlcUXj6pENJ3XMYzoQ5GnE4Vz3O3FGm+b5rNX5FGnBv8Q+blkE9lZwzQy yLEUDdRgjli0Kl4h/tGoM02dHeuYx4tCgzGqq4HjAab8YKmk5emz0xedpKsHRhI5x/5r tVPhGdc3WHWJbIhz9wQfWvbueaoTjEjr+DWiidE7WfjsiVGovaWtqhL5HZ8gbQECodiq pTTg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w8si18024333edr.279.2021.05.26.01.11.26; Wed, 26 May 2021 01:11:50 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231993AbhEZICu (ORCPT + 99 others); Wed, 26 May 2021 04:02:50 -0400 Received: from mga09.intel.com ([134.134.136.24]:38736 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231211AbhEZICd (ORCPT ); Wed, 26 May 2021 04:02:33 -0400 IronPort-SDR: l/gVGa17sM5qa3ga4hhBvy0b2nCYooC8+e8k8zPk3oEP6+N5feC+DJ6XGD3KkSTs3TD9V/FZUI M4z+3m+PzNnQ== X-IronPort-AV: E=McAfee;i="6200,9189,9995"; a="202421709" X-IronPort-AV: E=Sophos;i="5.82,330,1613462400"; d="scan'208";a="202421709" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2021 01:00:58 -0700 IronPort-SDR: ZgaIrmckF0JcL73H8IeXBynjPAIxVQgl3TYj/R0jJtGJy0Bs0pKADSeLxmbBjwd79XD8FTKvW5 cRKL8dm/2pJw== X-IronPort-AV: E=Sophos;i="5.82,330,1613462400"; d="scan'208";a="547101047" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2021 01:00:55 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lloTD-00Ekbj-ML; Wed, 26 May 2021 11:00:51 +0300 Date: Wed, 26 May 2021 11:00:51 +0300 From: Andy Shevchenko To: Andrew Morton Cc: Trent Piepho , 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: References: <20210525144250.214670-1-tpiepho@gmail.com> <20210525144654.e41cb942a2804d08127ad48f@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210525144654.e41cb942a2804d08127ad48f@linux-foundation.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 25, 2021 at 02:46:54PM -0700, Andrew Morton wrote: > 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? Doubtfully. What I can imagine (which also can be impossible) is to try on some UART drivers that use this algorithm to ask crazy baud rates (much higher than the clock). Sounds like a theoretical possibility is present, but practically no one except bad hackers would do that (requires a special code to be written in user space to select BOTHER with an arbitrary input in termios). > IOW, should it be backported into -stable and fast-tracked into 5.13 or > will a 5.14 merge suffice? -- With Best Regards, Andy Shevchenko