diff options
author | Linus Groh <mail@linusgroh.de> | 2023-02-24 23:34:54 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-02-24 23:40:23 +0100 |
commit | 69f0339bacb5ab6ace866a0d2ee6ce277ac82665 (patch) | |
tree | 2ca1dd445d544c2a5ed61366432e9db6040a095a /Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp | |
parent | b27f88f61de989b5c97f668a95467dbb0c6234f4 (diff) | |
download | serenity-69f0339bacb5ab6ace866a0d2ee6ce277ac82665.zip |
Revert "LibDeviceTree: Propagate try_append() errors while parsing paths"
This reverts commit f064f5f36e6c4ec9d96122815ed359d6290f8de2.
As Andrew points out, this append is not actually fallible in practice,
since the loop is terminated once the vector size reaches its inline
capacity.
https://github.com/SerenityOS/serenity/pull/17606#discussion_r1117662246
Diffstat (limited to 'Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp')
-rw-r--r-- | Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp b/Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp index a0e6449df8..d44f2c958f 100644 --- a/Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp +++ b/Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp @@ -113,9 +113,12 @@ static ErrorOr<ReadonlyBytes> slow_get_property_raw(StringView name, FlattenedDe // Name is a path like /path/to/node/property Vector<StringView, 16> path; TRY(name.for_each_split_view('/', SplitBehavior::Nothing, [&path](StringView view) -> ErrorOr<void> { - if (path.size() == path.capacity()) + if (path.size() == path.capacity()) { return Error::from_errno(ENAMETOOLONG); - return path.try_append(view); + } + // This can never fail as all entries go into the inline buffer, enforced by the check above. + MUST(path.try_append(view)); + return {}; })); bool check_property_name = path.size() == 1; // Properties on root node should be checked immediately |