From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kh4L0-0000BF-Bb for mharc-grub-devel@gnu.org; Mon, 23 Nov 2020 00:24:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kh4Kz-00007V-0v for grub-devel@gnu.org; Mon, 23 Nov 2020 00:24:29 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:37222) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kh4Kx-0006cx-Cn for grub-devel@gnu.org; Mon, 23 Nov 2020 00:24:28 -0500 Received: by mail-wm1-x341.google.com with SMTP id h21so16083228wmb.2 for ; Sun, 22 Nov 2020 21:24:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S/UXyX+ZltLkcb73159hY3DUsfVjDevnilLsLRANhEQ=; b=QlQkn7jBtfZl9kVD0gnBDv/aGwQWy20CsdkvaSWp+yMJLMKL2y5nDr+FzxzdJWQkLb dEsBbQabSUoBs9XaPXkka/xKlwuBBp2D7PFtZ8LMnmLBSLMgOORWRZ/E//235o8BUDe6 4VNWjm5e8BYYkogmnieliVsR/at9DpM/PdQdn3F335Nd9iTmpMrogvaWQhja4eiBMKUV CbvOAKC1CVL9Qtqklg4aSrrdfHAF4uRT+dVBX+K5XuMc2U8EqZr2qAxeKKBMFunJOLPo CRnaoMIOq6DKsgtJGsQq/zGvPt0rWjsgYmjmZpenYnPaZ4yVKxAxjQsX4fZnX20COPnr adfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S/UXyX+ZltLkcb73159hY3DUsfVjDevnilLsLRANhEQ=; b=RY2KcAZBdtYnUM4vAqL6vJnXvkEgVi+SHtO13mFxJ4wUvYtw8foPcowTbFNo6ln/P9 rSlg9jeOueW9q/Osv8OYM25iN20AqxSeDmSZGBJkorWaF0EkHAR3Mq6nbQTVlMJGQLp7 C+evi0fYW4UM/TIOwjAG45f86VABrsgk4bN2MKmz0nb2tN6U1SIdcOfDAB6oaWQcONEG xJVi4bUzqYyTTfRUrcTr3b6nec3KdLhsFPx+IcjYtjqMzB17Fdfjl1MtUzY1Izp+ZpaJ BDc+7dOzfXQ9/uxPSNEVYQKR3EjbX8rnklH24UxjRarNl0+vEbLYQQm8eCDf6n0/+vni 0c/A== X-Gm-Message-State: AOAM532RLpptO7SgH9H43AD/X7lQNGqByhv72i5NT3LtXGIIpiHpykn8 XWK9K94kzQyuc5abkBRJwsxcmyMTc2E9yg== X-Google-Smtp-Source: ABdhPJxZ7rvSpRkDb9aBNcdfsFHfvh4nkm5WIj4bSeaYwexLOA9YNkZdzB7BUS/Eb4vtCgxKjd6M7w== X-Received: by 2002:a1c:df89:: with SMTP id w131mr12265419wmg.164.1606109065990; Sun, 22 Nov 2020 21:24:25 -0800 (PST) Received: from localhost.localdomain ([136.49.211.192]) by smtp.gmail.com with ESMTPSA id f16sm11631780wmh.7.2020.11.22.21.24.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Nov 2020 21:24:25 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org Cc: Patrick Steinhardt , Daniel Kiper , Glenn Washburn Subject: [PATCH v5 11/11] luks2: Use grub_log2ull to calculate log_sector_size and improve readability Date: Sun, 22 Nov 2020 23:23:24 -0600 Message-Id: <8dd088cad6783749b7c999183abe14208218cd16.1606108123.git.development@efficientek.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=development@efficientek.com; helo=mail-wm1-x341.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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: Mon, 23 Nov 2020 05:24:29 -0000 Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 7e7b79d17..de3933be8 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -639,8 +639,7 @@ luks2_recover_key (grub_disk_t source, /* Set up disk according to keyslot's segment. */ crypt->offset_sectors = grub_divmod64 (segment.offset, segment.sector_size, NULL); - crypt->log_sector_size = sizeof (unsigned int) * 8 - - __builtin_clz ((unsigned int) segment.sector_size) - 1; + crypt->log_sector_size = grub_log2ull (segment.sector_size); /* Set to the source disk size, which is the maximum we allow. */ max_crypt_sectors = grub_disk_convert_sector(source, source->total_sectors, -- 2.27.0