Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp864549rwr; Wed, 19 Apr 2023 14:29:31 -0700 (PDT) X-Google-Smtp-Source: AKy350b+i75WBtEQ3+WJg7+uvCv2AnLXKR80vLo6AEUfHhKqbXoTJUvtQV9dToWcSclgqxB1UL+h X-Received: by 2002:a17:903:110c:b0:1a6:a7f4:b5 with SMTP id n12-20020a170903110c00b001a6a7f400b5mr7478014plh.18.1681939770862; Wed, 19 Apr 2023 14:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681939770; cv=none; d=google.com; s=arc-20160816; b=FSAYHTdjrirCeckPAcykugA6CK+nkMwZrHOkbG757TYbTYGK8OlMbYYANTZJyB8n1j 782fdMYvCxkw2rmnW2q4OZaZ0AdwShl6VXdtfeQDHtwoW4JHUkoyah6AWvjdfCQ2p+qE rQwhil39cfpGu1L0iZW6XdDSo+an9kfPSBjnG393qzDQfPjUfa1KOEnhbI6xB7ksp0+K 9kRSOHjVVVV7pErYgyRuT9DwCUuq4USIpmA+/3eNqdGmr8Ge/e3G4FhGnDaAbiiaCi4J VPDTmzlxCY0t2+6kW5JedNL0R2xJIhDzuSnw2UfwpcgJWV+iRidBbwLjalBLyhN28Y21 CBSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=hB4HHuJN4IJW9oNX6+Y7DbQsTiooPwS2oWzEDsLMm2o=; b=ISwzVow7+DrUZ0a0kFtGOmc2Ja6mOvEO9YTSCfIcd1+OPInYRolCKr+bZLH3rMFHVn 7Zyt8nAxBmI2P/xQ3+FskxXja5JXiNPyAKEIPoWBMYNzRk7n+4WusS0GT+dcHt3r+ON5 waE9dMXaISngrEBMULgYmJfOLOmw6IxQ+ERPSf/+JDta1nJju4UoM8ELWWNjWcGV5aTo qN2vrUYi2upc9rj8a4WKFOq2pYigZXHKsxlR7HvZVWIoVPJ6jCKfalJuNrsakWU80qMf ta6sLdWs2zQHhLMVPYoFKN3YK04swORi/LyEgaNeBJh8km6O9uFggOEyM4LpGzX4HBqC VelA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a170903124e00b001a66afd1fcfsi17806648plh.651.2023.04.19.14.29.16; Wed, 19 Apr 2023 14:29:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232608AbjDSVZl convert rfc822-to-8bit (ORCPT + 99 others); Wed, 19 Apr 2023 17:25:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231217AbjDSVZj (ORCPT ); Wed, 19 Apr 2023 17:25:39 -0400 Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E79C6974B; Wed, 19 Apr 2023 14:25:12 -0700 (PDT) Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.95) with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1ppFIV-003hnW-FK; Wed, 19 Apr 2023 23:25:03 +0200 Received: from p5b13a017.dip0.t-ipconnect.de ([91.19.160.23] helo=suse-laptop.fritz.box) by inpost2.zedat.fu-berlin.de (Exim 4.95) with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1ppFIV-0002on-88; Wed, 19 Apr 2023 23:25:03 +0200 Message-ID: <149653ffbfa13e508777214174341f9c1263a487.camel@physik.fu-berlin.de> Subject: Re: [PATCH RESEND] sh: sq: Use the bitmap API when applicable From: John Paul Adrian Glaubitz To: Christophe JAILLET , Geert Uytterhoeven Cc: Yoshinori Sato , Rich Felker , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-sh@vger.kernel.org Date: Wed, 19 Apr 2023 23:25:01 +0200 In-Reply-To: References: <071e9f32c19a007f4922903282c9121898641400.1681671848.git.christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.48.0 MIME-Version: 1.0 X-Original-Sender: glaubitz@physik.fu-berlin.de X-Originating-IP: 91.19.160.23 X-ZEDAT-Hint: PO X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Hi Christophe! On Tue, 2023-04-18 at 20:05 +0200, Christophe JAILLET wrote: > Le 18/04/2023 à 09:14, Geert Uytterhoeven a écrit : > > > > Nice catch! > > > > Looking more deeply at the code, the intention is to allocate a bitmap > > with nr_pages bits, so the code fater Christophe's patch is correct. > > However, the old code is indeed wrong: > > > > (nr_pages + (BITS_PER_LONG - 1)) / BITS_PER_LONG > > > > The aim is to calculate the size in bytes, rounded up to an integral > > number of longs, but it lacks a final multiplication by BITS_PER_BYTE, > > so it's off by a factor of 4. > > > > Fixes: d7c30c682a278abe ("sh: Store Queue API rework.") > > > > As we didn't have bitmap_zalloc() until commit c42b65e363ce97a8 > > ("bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()") > > in v4.19, it would be good to fix the bug first in a separate patch, > > not using > > > > BTW, interesting how this got missed when fixing the other out-of-range > > bug in commit 9f650cf2b811cfb6 ("sh: Fix store queue bitmap end.", > > s/marc.theaimsgroup.com/marc.info/ when following the link). > > So, this means that this got unnoticed for 16 years? > Waouh! > > I would never have thought that a "trivial" clean-up that I took time to > repost could trigger such a thing! I have fixed the original bug in my for-next branch [1] now. Would you mind rebasing your patch on top of that branch and resend it? The reason why we're doing this is because we want to be able to backport the fix to older kernel versions such as 4.14 which don't have the bitmap API yet. Thanks, Adrian > [1] https://git.kernel.org/pub/scm/linux/kernel/git/glaubitz/sh-linux.git/log/?h=for-next -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913