Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
luks2: Use grub_log2ull() to calculate log_sector_size and improve re…
Browse files Browse the repository at this point in the history
…adability

Signed-off-by: Glenn Washburn <[email protected]>
Reviewed-by: Daniel Kiper <[email protected]>
  • Loading branch information
crass authored and Daniel Kiper committed Dec 18, 2020
1 parent 3ab19ba commit ec46685
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions grub-core/disk/luks2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, GRUB_DISK_SECTOR_BITS,
Expand Down

0 comments on commit ec46685

Please sign in to comment.