[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 6/6] luks2: Use grub_log2ull to calculate log_sector_size and
From: |
Glenn Washburn |
Subject: |
[PATCH v9 6/6] luks2: Use grub_log2ull to calculate log_sector_size and improve readability |
Date: |
Tue, 15 Dec 2020 17:31:11 -0600 |
Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.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 0e5061243..1ff89089e 100644
--- a/grub-core/disk/luks2.c
+++ b/grub-core/disk/luks2.c
@@ -642,8 +642,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/partition size, which is the maximum we allow.
*/
max_crypt_sectors = grub_disk_native_sectors(source);
max_crypt_sectors = grub_convert_sector(max_crypt_sectors,
--
2.27.0
- [PATCH v9 1/6] luks2: Convert to crypt sectors from grub native sectors, (continued)
- [PATCH v9 1/6] luks2: Convert to crypt sectors from grub native sectors, Glenn Washburn, 2020/12/15
- [PATCH v9 2/6] luks2: Do not handle disks of size GRUB_DISK_SIZE_UNKNOWN for now, Glenn Washburn, 2020/12/15
- [PATCH v9 3/6] luks2: Better error handling when setting up the cryptodisk, Glenn Washburn, 2020/12/15
- [PATCH v9 4/6] mips: Enable __clzdi2(), Glenn Washburn, 2020/12/15
- [PATCH v9 5/6] misc: Add grub_log2ull macro for calculating log base 2 of 64-bit integers, Glenn Washburn, 2020/12/15
- [PATCH v9 6/6] luks2: Use grub_log2ull to calculate log_sector_size and improve readability,
Glenn Washburn <=