Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix /sys/block sysfs parsing for eMMC-s #150

Merged
merged 1 commit into from
Apr 22, 2020

Conversation

jwrdegoede
Copy link
Contributor

Commit 4718694 ("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 position to use is always pos1 independent if we got
passed the whole disk; or a partition, 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 4718694, 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.

Also see: https://bugzilla.redhat.com/show_bug.cgi?id=1826864

Commit 4718694 ("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 position to use is always pos1 independent if we got
passed the whole disk; or a partition, 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 4718694, 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>
@vathpela vathpela merged commit f0d3ed1 into rhboot:master Apr 22, 2020
@jwrdegoede jwrdegoede deleted the sysfs-emmc-parse-fix branch April 22, 2020 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants