[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/9] cryptodisk: Incorrect calculation of start sector for grub_d
From: |
Patrick Steinhardt |
Subject: |
[PATCH 7/9] cryptodisk: Incorrect calculation of start sector for grub_disk_read in grub_cryptodisk_read |
Date: |
Sun, 23 Aug 2020 13:04:17 +0200 |
From: Glenn Washburn <development@efficientek.com>
Here dev is a grub_cryptodisk_t and dev->offset is offset in sectors of size
native to the cryptodisk device. The sector is correctly transformed into
native grub sector size, but then added to dev->offset which is not
transformed. It would be nice if the type system would help us with this.
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
grub-core/disk/cryptodisk.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
index b2c6e9a7d..76ec2d4b9 100644
--- a/grub-core/disk/cryptodisk.c
+++ b/grub-core/disk/cryptodisk.c
@@ -757,8 +757,8 @@ grub_cryptodisk_read (grub_disk_t disk, grub_disk_addr_t
sector,
size, sector, dev->offset);
err = grub_disk_read (dev->source_disk,
- (sector << (disk->log_sector_size
- - GRUB_DISK_SECTOR_BITS)) + dev->offset, 0,
+ ((sector + dev->offset) << (disk->log_sector_size
+ - GRUB_DISK_SECTOR_BITS)), 0,
size << disk->log_sector_size, buf);
if (err)
{
--
2.28.0
signature.asc
Description: PGP signature
- [PATCH 1/9] json: Remove invalid typedef redefinition, (continued)
- [PATCH 1/9] json: Remove invalid typedef redefinition, Patrick Steinhardt, 2020/08/23
- [PATCH 2/9] luks: Fix out-of-bounds copy of UUID, Patrick Steinhardt, 2020/08/23
- [PATCH 3/9] luks2: Fix use of incorrect index and some error messages, Patrick Steinhardt, 2020/08/23
- [PATCH 4/9] luks2: grub_cryptodisk_t->total_length is the max number of device native sectors, Patrick Steinhardt, 2020/08/23
- [PATCH 5/9] luks2: Improve error reporting when decrypting/verifying key, Patrick Steinhardt, 2020/08/23
- [PATCH 6/9] cryptodisk: Unregister cryptomount command when removing module, Patrick Steinhardt, 2020/08/23
- [PATCH 7/9] cryptodisk: Incorrect calculation of start sector for grub_disk_read in grub_cryptodisk_read,
Patrick Steinhardt <=
- [PATCH 8/9] cryptodisk: Fix cipher IV mode 'plain64' always being set as 'plain', Patrick Steinhardt, 2020/08/23
- [PATCH 9/9] cryptodisk: Properly handle non-512 byte sized sectors, Patrick Steinhardt, 2020/08/23
- Re: [PATCH 0/9] Cryptodisk fixes for v2.06, Glenn Washburn, 2020/08/24
- [PATCH v2 0/9] Cryptodisk fixes for v2.06, Patrick Steinhardt, 2020/08/26
- [PATCH v2 1/9] json: Remove invalid typedef redefinition, Patrick Steinhardt, 2020/08/26
- [PATCH v2 2/9] luks: Fix out-of-bounds copy of UUID, Patrick Steinhardt, 2020/08/26
- [PATCH v2 3/9] luks2: Fix use of incorrect index and some error messages, Patrick Steinhardt, 2020/08/26
- [PATCH v2 4/9] luks2: grub_cryptodisk_t->total_length is the max number of device native sectors, Patrick Steinhardt, 2020/08/26
- [PATCH v2 5/9] luks2: Improve error reporting when decrypting/verifying key, Patrick Steinhardt, 2020/08/26