974b936917
The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/efivar#9f54d8029387895b7b1389d9a9f9e0bf476a027f
56 lines
1.8 KiB
Diff
56 lines
1.8 KiB
Diff
From 54dad567c41b57c4843329856ca5047e63325a9f Mon Sep 17 00:00:00 2001
|
|
From: Hans de Goede <hdegoede@redhat.com>
|
|
Date: Wed, 22 Apr 2020 19:33:01 +0200
|
|
Subject: [PATCH] Fix /sys/block sysfs parsing for eMMC-s
|
|
|
|
Commit 471869409464 ("sysfs parsers: make all the /sys/block link
|
|
parsers work the same way") has broken sysfs parsing for eMMC-s when
|
|
the passed in path points to the whole block device.
|
|
|
|
In that case pos2 will stay at its -1 initializaton value, because we
|
|
only do 4 conversions; and when we then do:
|
|
|
|
current += pos2
|
|
|
|
We end up moving current one char position backwards and we end up
|
|
returning -1.
|
|
|
|
The correct positing to use is always pos1 independent if we got
|
|
passed the whole disk; or a parition, as we always want to return
|
|
only the part which points to whole disk which ends at pos1.
|
|
|
|
Note that it seems that before commit 471869409464, the case where
|
|
path points to the partition was likely broken as the old code then
|
|
would return the entire path including the partition element.
|
|
|
|
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1826864
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
---
|
|
src/linux-emmc.c | 9 +++------
|
|
1 file changed, 3 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/linux-emmc.c b/src/linux-emmc.c
|
|
index 800dc14..65557b4 100644
|
|
--- a/src/linux-emmc.c
|
|
+++ b/src/linux-emmc.c
|
|
@@ -56,13 +56,10 @@ parse_emmc(struct device *dev, const char *path, const char *root UNUSED)
|
|
dev->emmc_info.slot_id = slot_id;
|
|
dev->interface_type = emmc;
|
|
|
|
- if (rc == 6) {
|
|
- if (dev->part == -1)
|
|
- dev->part = partition;
|
|
+ if (rc == 6 && dev->part == -1)
|
|
+ dev->part = partition;
|
|
|
|
- pos2 = pos1;
|
|
- }
|
|
- current += pos2;
|
|
+ current += pos1;
|
|
|
|
debug("current:'%s' sz:%zd", current, current - path);
|
|
return current - path;
|
|
--
|
|
2.26.0
|
|
|