[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v8 15/18] luks2: Error check segment.sector_size
From: |
Patrick Steinhardt |
Subject: |
Re: [PATCH v8 15/18] luks2: Error check segment.sector_size |
Date: |
Sat, 12 Dec 2020 09:16:23 +0100 |
On Tue, Dec 08, 2020 at 04:45:46PM -0600, Glenn Washburn wrote:
> Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
> ---
> grub-core/disk/luks2.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c
> index 8cb11e899..c737797b9 100644
> --- a/grub-core/disk/luks2.c
> +++ b/grub-core/disk/luks2.c
> @@ -629,6 +629,17 @@ luks2_recover_key (grub_disk_t source,
>
> grub_dprintf ("luks2", "Trying keyslot \"%"PRIuGRUB_UINT64_T"\"\n",
> keyslot.idx);
>
> + /* Sector size should be one of 512, 1024, 2048, or 4096. */
> + if (!(segment.sector_size == 512 || segment.sector_size == 1024 ||
> + segment.sector_size == 2048 || segment.sector_size == 4096))
> + {
> + grub_dprintf ("luks2", "Segment \"%"PRIuGRUB_UINT64_T"\" sector"
> + " size %"PRIuGRUB_UINT64_T" is not one of"
> + " 512, 1024, 2048, or 4096\n",
> + segment.idx, segment.sector_size);
> + continue;
> + }
> +
> /* 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
> --
> 2.27.0
>
signature.asc
Description: PGP signature
- [PATCH v8 10/18] cryptodisk: Add macro GRUB_TYPE_BITS() to replace some literals, (continued)
[PATCH v8 15/18] luks2: Error check segment.sector_size, Glenn Washburn, 2020/12/08
[PATCH v8 16/18] mips: Enable __clzdi2(), Glenn Washburn, 2020/12/08
[PATCH v8 18/18] luks2: Use grub_log2ull to calculate log_sector_size and improve readability, Glenn Washburn, 2020/12/08
Re: [PATCH v8 00/18] Cryptodisk fixes for v2.06 redux, Daniel Kiper, 2020/12/10