Skip to contentSkip to conversation

partitions: efi: Continue partition enumeration on invalid pte

PATCH Applied Christopher Ebner 2 participants 2 messages Jun 5, 2023 – Jun 6, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 partitions: efi: Continue partition enumeration on invalid pte

The efi partition enumeration stops, if a partition entry is invalid or non-existent.
Later partitions which would be valid are therefore not enumerated. This can be the case, eg. if a device with the following partitions is enumerated: p1, p2, p4, p5, p6.
Skipping the invalid entry instead of exiting the enumeration fixes this problem.

---
 common/partitions/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/partitions/efi.c +1 -1
index ffdbd9a56f..0411a8b248 100644
@@ -460,7 +460,7 @@ static void efi_partition(void *buf, struct block_device *blk,
 	for (i = 0; i < nb_part; i++) {
 		if (!is_pte_valid(&ptes[i], last_lba(blk))) {
 			dev_dbg(blk->dev, "Invalid pte %d\n", i);
-			return;
+			continue;
 		}
 
 		pentry = &pd->parts[pd->used_entries];
Signature · 1 line
2.25.1
Applied
#1 lore raw
Quoted 8 lines · Christopher Ebner

The efi partition enumeration stops, if a partition entry is invalid or non-existent.
Later partitions which would be valid are therefore not enumerated. This can be the case, eg. if a device with the following partitions is enumerated: p1, p2, p4, p5, p6.
Skipping the invalid entry instead of exiting the enumeration fixes this problem.

Quoted 4 lines
---
 common/partitions/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

Quoted 19 lines
common/partitions/efi.c +1 -1
index ffdbd9a56f..0411a8b248 100644
@@ -460,7 +460,7 @@ static void efi_partition(void *buf, struct block_device *blk,
 	for (i = 0; i < nb_part; i++) {
 		if (!is_pte_valid(&ptes[i], last_lba(blk))) {
 			dev_dbg(blk->dev, "Invalid pte %d\n", i);
-			return;
+			continue;
 		}
 
 		pentry = &pd->parts[pd->used_entries];
Signature · 1 line
2.25.1
Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |