libs: libfdt: Fix Fdt::header() using bad pointer

Fix a bug where a reference to the DT was erroneously obtained through
&self (instead of self) which was causing Fdt::totalsize() to return a
wrong value (probably read from the stack where &self pointed to), in
turn making Fdt::as_slice() return the wrong region of memory. This UB
seems to have consistently resulted in fdt.totalsize() == 0 i.e.
fdt.as_slice() == &[] and has gone unnoticed until now.

Avoid casting pointers with as in as_{mut_,}ptr().

Bug: 280425124
Test: atest MicrodroidHostTests
Change-Id: Ie31f6c6f19e756ee843d1fd2f11f106590e99395
1 file changed
tree: 6f8b627904b8829f7ee0497f73d9f07b108510c3
  1. apex/
  2. apkdmverity/
  3. authfs/
  4. compos/
  5. demo/
  6. docs/
  7. encryptedstore/
  8. javalib/
  9. launcher/
  10. libs/
  11. microdroid/
  12. microdroid_manager/
  13. pvmfw/
  14. rialto/
  15. service_vm/
  16. tests/
  17. virtualizationmanager/
  18. virtualizationservice/
  19. vm/
  20. vm_payload/
  21. vmbase/
  22. vmclient/
  23. zipfuse/
  24. .clang-format
  25. .gitignore
  26. Android.bp
  27. OWNERS
  28. PREUPLOAD.cfg
  29. README.md
  30. TEST_MAPPING
README.md

Virtualization

This repository contains userspace services related to running virtual machines on Android, especially protected virtual machines. See the getting started documentation and Microdroid README for more information.