Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp668893imn; Thu, 28 Jul 2022 12:08:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vUzgbWrPJAv6u583tfFIW1v5P7Fyywx3SyEK0TgjTgCFiyKbrMsRPFdseDtr2sJbAGGG1A X-Received: by 2002:a05:6402:448b:b0:43b:5ec6:8863 with SMTP id er11-20020a056402448b00b0043b5ec68863mr333335edb.377.1659035293803; Thu, 28 Jul 2022 12:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659035293; cv=none; d=google.com; s=arc-20160816; b=E/xYZbn4Ztctk7yUFKQv493+P4MqQlWatEgXTnhoBsa3TbQiJEU/LB15zuI4qhLE06 iqF0+Hu0pfBKZArqphYuh6ToGoH/DAh8u9g8sQrWniAO8MWlAn21OV8GmWSBldjaytek lNU2BNJ3O+Y6Ry248L37EB8RwTm975JJqdGZ3A5RSwSCZfGhr2EyM9dQdbRVveO843Co go3U/ZwRv2PjRpXOHE4atk3gZAy19I0Kwv6Mqfo4S1bvdTbeuXSINE5G7I42ijtfRr+N Auv7VBdsWPt55R+m2ticZJDHyIqTTK0HGPYjWxOBrWt+2a5twKvZMjotO7RDuqTzFtLK LJcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=8en1dUZtVi+OtbnjpKM2o5kUvsguWNwrKsWi5O1zrkw=; b=bjqETpSKejlhR8zQXgbasp9AigYJKaIu4P9fbBDRldjZ2j9xg5/1KF9wIjlcfds/ud TI1Zf1jtrVaVljWR1Mic7i3jWvsV1yYgiXg0MQQ6blhQFqd9dvaLMKbynJnfrb+IwvSX OtObAmOokII4Dk3HAuc8MbUiX2krmeiLTgYYoMYHnLN4dy0w3Pj/l1hVM//WdLilQ0MV DqzmczkCZvpFGQLYpFXqOBPtjzBdrLNa0xEjkxguATwzqNvthmp+tnM3FiLF67K8/BB9 3OpzIx/f7eaWz+mhBPnNl7kLG9tkli8E+jI4Ou6ibvrw2aHzY8Y94sTNv/g4zdxoZOg4 ePZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=NPJvcL7r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h9-20020a056402280900b0043c2a52a91fsi1467221ede.456.2022.07.28.12.07.49; Thu, 28 Jul 2022 12:08:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=NPJvcL7r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbiG1S2h (ORCPT + 99 others); Thu, 28 Jul 2022 14:28:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiG1S2f (ORCPT ); Thu, 28 Jul 2022 14:28:35 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADC8E6D564 for ; Thu, 28 Jul 2022 11:28:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8en1dUZtVi+OtbnjpKM2o5kUvsguWNwrKsWi5O1zrkw=; b=NPJvcL7rNtP72r0d+7Suy59IFh wFMuQ3nRTSwELo770zYkYZ3iuLEHBoY92nhKztK74cOEWft3CYq+38Knw9tBlPvm+uznS0hLrirIR uER8T0NWTPNQk4gXA3L6Umk6dXGcl66RLlvPOJluXVLe+WDur3ITCOzIJEm6YpMDfhyKReRB8S6I5 J3sS5m52wPpJS8kfDNuIRy8zFF1Kl/S3c03+X1/ygZliuTABJH5MoTvpGtlWQborrQr6rb6igHTz7 ribOKa9Saq408azt5yQUC7Pb9183n+XHrCtivbr458Fw0j7ZGKsGl8eyprlZCOCVwdKLkCIM1FuM1 5mvfSrfg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:33614) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oH8FF-0006dn-45; Thu, 28 Jul 2022 19:28:26 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1oH8FC-0003Q4-A6; Thu, 28 Jul 2022 19:28:22 +0100 Date: Thu, 28 Jul 2022 19:28:22 +0100 From: "Russell King (Oracle)" To: Linus Torvalds Cc: Guenter Roeck , Yury Norov , Dennis Zhou , Catalin Marinas , Linux Kernel Mailing List Subject: Re: Linux 5.19-rc8 Message-ID: References: <20220725161141.GA1306881@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 26, 2022 at 10:12:21AM +0100, Russell King (Oracle) wrote: > First I'm aware of it. Was it reported to linux-arm-kernel? I'm guessing > the report wasn't Cc'd to me - I can't find anything in my mailbox about > it. > > > I think the fix might be something like this: > > > > diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S > > index b5e8b9ae4c7d..b36ca301892e 100644 > > --- a/arch/arm/lib/findbit.S > > +++ b/arch/arm/lib/findbit.S > > @@ -83,6 +83,8 @@ ENDPROC(_find_first_bit_le) > > ENTRY(_find_next_bit_le) > > teq r1, #0 > > beq 3b > > + cmp r2, r1 > > + bhs 3b > > ands ip, r2, #7 > > beq 1b @ If new byte, goto old routine > > ARM( ldrb r3, [r0, r2, lsr #3] ) > > > > but my ARM asm is so broken that the above is just really random noise > > that may or may not build - much less work. > > > > I'll leave it to Russell &co to have a tested and working patch. > > I think it needs a bit more than that, but as you point out in later > emails, the compiler may do a better job for this. Okay, I've moved my patch that fixes this (without adding a single line of code!) to my fixes branch, which I'll ask you to pull in the next couple of days. Each of the _find_next_* functions had: teq r1, #0 beq 3b at the beginning to catch the case where size == 0. This is now: cmp r2, r1 bhs 3b which is the C equivalent of: if (offset >= size) goto 3b; where both are unsigned, and nicely covers the case where size == 0 as before (since if size is 0, the condition is always true irrespective of the value of offset.) We can sort out the question of keeping this code or not later, but I think as this has been spotted as an issue, it's important to get it fixed. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!