From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1klzxt-0001Zk-AV for mharc-grub-devel@gnu.org; Sun, 06 Dec 2020 14:45:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klzxs-0001ZH-6i for grub-devel@gnu.org; Sun, 06 Dec 2020 14:45:00 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:40789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klzxl-0000ti-3i for grub-devel@gnu.org; Sun, 06 Dec 2020 14:44:59 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 6C5A85C01CA; Sun, 6 Dec 2020 14:44:52 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 06 Dec 2020 14:44:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=A4/JTbBZTwjttIjFl5Yp+LbMA9Y ThA1mNwW2TPyo8W0=; b=Xaj068PoS8tAELimVgLpG69RlYybOzfnXesoNRpoV9M 6gW8/BKkv0+1wK9VV7r6qnYtsQ9VcTP63SXCN5RySQqnM6+2d0xyuNd9xIUaITd0 kL/pdoBd3dzo623TTDaxLAKmxMnxbtlh+crQLWkG3qcblzlYVVkqe6ba7RLO0QiR 5EEdePiW/RpyHuhmxmjeO5hE7AP0E0trWrXiX9leAa1jFCQIWu9CVwnwpNTj4Qhh RGtlzQLE7H6SRMpRTFpw2d6MLQw7ko9mAsTnZzhYVGLXuTXofA5MZ4kMADNUHWZ+ GqUFtYiTXe8U2niMmVi1KP5zHnPXhNgDG4myJUUge+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=A4/JTb BZTwjttIjFl5Yp+LbMA9YThA1mNwW2TPyo8W0=; b=nVwGxqyw8XP9iOlikEvMof DqTWWTFHV6DwL9+oGStlGcoQomH8U7XzRzIYqha2/XxJVLBMbaW9WMKhoXGKjzvv tzgpaZC5sjO6zZifxzdGeyB3qYIrytSg/+GcwBotbZ0Ett38F0hzxqJFEvCMC/Lv qxn96yRve1MfFUkVxNxUypIMoveN+VehfZwxdgOOVusR1q92+cpU8IbFmqued9hJ qjWGQNgxj3vtiHTY2Axm7LD/f4sC0ZKmLMl3jzuaA4SKLAdlXdclGvv9RsfdwbkC CPKXNpDgYBkFoeH5Y5I3cFHhz740toc4MjOpTKEcUTS5GfLaFFqcIG3NyL+9DhMA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudejvddgudeftdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhr ihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvg hrnhepheeghfdtfeeuffehkefgffduleffjedthfdvjeektdfhhedvlefgtefgvdettdfh necukfhppeejjedrudekfedrudejrdduuddtnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepphhssehpkhhsrdhimh X-ME-Proxy: Received: from vm-mail (x4db7116e.dyn.telefonica.de [77.183.17.110]) by mail.messagingengine.com (Postfix) with ESMTPA id 8CC1624005E; Sun, 6 Dec 2020 14:44:50 -0500 (EST) Received: from localhost (ncase [10.192.0.11]) by vm-mail (OpenSMTPD) with ESMTPSA id f818286c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 6 Dec 2020 19:44:49 +0000 (UTC) Date: Sun, 6 Dec 2020 20:44:48 +0100 From: Patrick Steinhardt To: Glenn Washburn Cc: grub-devel@gnu.org, Daniel Kiper , Daniel Kiper Subject: Re: [PATCH v7 17/17] luks2: Use grub_log2ull to calculate log_sector_size and improve readability Message-ID: References: <8b97e688757dd244a6f199bb0cf258ac196375a0.1607098915.git.development@efficientek.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="aJ1rZprixeJ6WkUr" Content-Disposition: inline In-Reply-To: <8b97e688757dd244a6f199bb0cf258ac196375a0.1607098915.git.development@efficientek.com> Received-SPF: pass client-ip=66.111.4.28; envelope-from=ps@pks.im; helo=out4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2020 19:45:00 -0000 --aJ1rZprixeJ6WkUr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 04, 2020 at 10:43:46AM -0600, Glenn Washburn wrote: > Reviewed-by: Daniel Kiper > Signed-off-by: Glenn Washburn > --- > grub-core/disk/luks2.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) >=20 > diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c > index 2335ded77..4fa5a0dbc 100644 > --- a/grub-core/disk/luks2.c > +++ b/grub-core/disk/luks2.c > @@ -642,8 +642,7 @@ luks2_recover_key (grub_disk_t source, > =20 > /* Set up disk according to keyslot's segment. */ > crypt->offset_sectors =3D grub_divmod64 (segment.offset, segment.s= ector_size, NULL); > - crypt->log_sector_size =3D sizeof (unsigned int) * 8 > - - __builtin_clz ((unsigned int) segment.sector_size) - 1; > + crypt->log_sector_size =3D grub_log2ull (segment.sector_size); I was quite confused by the fact that previously we were using an unsigned int (which typically is 4 bytes on 64 bit systems), but now we're using the 8 byte wide uint64. Until I realized that `grub_log2ull(n)` uses `__builtin_clzll` instead of `__builtin_clz`. A commit message would've helped to clear up this confusion. Other than that: Reviewed-by: Patrick Steinhardt > /* Set to the source disk size, which is the maximum we allow. */ > max_crypt_sectors =3D grub_disk_convert_sector(source, > source->total_sectors, > --=20 > 2.27.0 >=20 --aJ1rZprixeJ6WkUr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEF9hrgiFbCdvenl/rVbJhu7ckPpQFAl/NNK8ACgkQVbJhu7ck PpQN0Q//VFi1SRhSlTh0qkkNUKATBU2cwpGxwYqfaG9xlXBQc2fOdf0HJYGoqaOk oRuqkPOXxxuIQE1EbbLrpePKnKagRM2iYVlD0FdiWKNt8a6G3485NtvuW70tllSQ u361oZdUZ8y1oLpoPmZMFqS4LK7Yd/bswoFjAB0kHjDAoCGIzVqmI0kW8llO6oeQ Uh7MJh8jFQ2kXH9ypIYKZXCl0C0Xu/gqBZOhlV7S+hI049TEs0QMbdQ5bhItnRaF QyNDLyXQL8B0XiaQvstHrCb82c2E7EyJpb24tvWiwRxEXXwM0vWUVfEL9S+An30O uNR8P5YXtR4xH8AakLKLGFmcYn4liBZ0c0K1RQTEy3Dde7BN6ZlCHV0B+npG992/ 4Hf0sec6qjR7JIA80l7cJl6NG3R00nlS34vkYBu8gQZ4T+GhLcmtSMUwinyXrbSU Os7DyXmuHSmXhXzsyZTRUbVPSsBC/CWQ3kcITzsit0O7/3c8k/Z62fPEKZOP7W8R hBnrqZ9reWMEYJWk3+qp58iBNWQCoO1rSCJ6gH5uJn+Stf9uTSc1HB5fnemNsBDw BiZAnrGs9lZ7WQ7chVyPzucDAXS3Lu4m8CaIqDBMrPYid4HR3TqTAAAL4RPFtGKM 56ss3B/yPCueCMARxgZxiTENXqPuSpkXlWxw5SmBsqhsNmg7LcE= =lQnq -----END PGP SIGNATURE----- --aJ1rZprixeJ6WkUr--