[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 12/12] luks2: Use grub_log2ull to calculate log_sector_size an
From: |
Glenn Washburn |
Subject: |
[PATCH v6 12/12] luks2: Use grub_log2ull to calculate log_sector_size and improve readability |
Date: |
Fri, 27 Nov 2020 03:03:44 -0600 |
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
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 c2129f929..173a14197 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
- [PATCH v6 02/12] luks2: Use more intuitive slot key instead of index in user messages., (continued)
- [PATCH v6 02/12] luks2: Use more intuitive slot key instead of index in user messages., Glenn Washburn, 2020/11/27
- [PATCH v6 03/12] luks2: Remove unused argument in grub_error, Glenn Washburn, 2020/11/27
- [PATCH v6 04/12] cryptodisk: Replace some literals with constants in grub_cryptodisk_endecrypt, Glenn Washburn, 2020/11/27
- [PATCH v6 05/12] luks2: grub_cryptodisk_t->total_sectors is the max number of device native sectors, Glenn Washburn, 2020/11/27
- [PATCH v6 06/12] cryptodisk: Properly handle non-512 byte sized sectors, Glenn Washburn, 2020/11/27
- [PATCH v6 07/12] luks2: Better error handling when setting up the cryptodisk, Glenn Washburn, 2020/11/27
- [PATCH v6 08/12] luks2: Error check segment.sector_size, Glenn Washburn, 2020/11/27
- [PATCH v6 09/12] whitespace: convert 8 spaces to tabs., Glenn Washburn, 2020/11/27
- [PATCH v6 10/12] mips: Enable __clzdi2(), Glenn Washburn, 2020/11/27
- [PATCH v6 11/12] misc: Add grub_log2ull macro for calculating log base 2 of 64-bit integers, Glenn Washburn, 2020/11/27
- [PATCH v6 12/12] luks2: Use grub_log2ull to calculate log_sector_size and improve readability,
Glenn Washburn <=