summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2023-02-24 21:03:39 +0000
committerLinus Groh <mail@linusgroh.de>2023-02-24 22:18:25 +0100
commitf064f5f36e6c4ec9d96122815ed359d6290f8de2 (patch)
treed1e978994b335a26202ecc3436a021a697a70345
parentc56e1c53783ae0f2c7388160cf88c0c6b7c09081 (diff)
downloadserenity-f064f5f36e6c4ec9d96122815ed359d6290f8de2.zip
LibDeviceTree: Propagate try_append() errors while parsing paths
-rw-r--r--Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp b/Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp
index a9a5bda556..a0e6449df8 100644
--- a/Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp
+++ b/Userland/Libraries/LibDeviceTree/FlattenedDeviceTree.cpp
@@ -113,11 +113,9 @@ 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);
- }
- MUST(path.try_append(view));
- return {};
+ return path.try_append(view);
}));
bool check_property_name = path.size() == 1; // Properties on root node should be checked immediately