LibDeviceTree: Propagate try_append() errors while parsing paths

This commit is contained in:
MacDue 2023-02-24 21:03:39 +00:00 committed by Linus Groh
parent c56e1c5378
commit f064f5f36e
Notes: sideshowbarker 2024-07-16 23:52:10 +09:00

View file

@ -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