Merge "libs: Use Self::capacity() in Fdt::check_full()" into main am: 82853526bd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/2763169
Change-Id: I7b6e403b4c3db3d543be06a9469aceb3e22e4126
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libs/libfdt/src/lib.rs b/libs/libfdt/src/lib.rs
index 1bf285e..9da2054 100644
--- a/libs/libfdt/src/lib.rs
+++ b/libs/libfdt/src/lib.rs
@@ -802,13 +802,12 @@
}
fn check_full(&self) -> Result<()> {
- let len = self.buffer.len();
// SAFETY: Only performs read accesses within the limits of the slice. If successful, this
// call guarantees to other unsafe calls that the header contains a valid totalsize (w.r.t.
// 'len' i.e. the self.fdt slice) that those C functions can use to perform bounds
// checking. The library doesn't maintain an internal state (such as pointers) between
// calls as it expects the client code to keep track of the objects (DT, nodes, ...).
- let ret = unsafe { libfdt_bindgen::fdt_check_full(self.as_ptr(), len) };
+ let ret = unsafe { libfdt_bindgen::fdt_check_full(self.as_ptr(), self.capacity()) };
fdt_err_expect_zero(ret)
}