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
Merged-In: Ie31f6c6f19e756ee843d1fd2f11f106590e99395
1 file changed
tree: 7961f14c485c2c739a300b5c80e061759f7cfc61
  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. tests/
  16. virtualizationmanager/
  17. virtualizationservice/
  18. vm/
  19. vm_payload/
  20. vmbase/
  21. vmclient/
  22. zipfuse/
  23. .clang-format
  24. .gitignore
  25. Android.bp
  26. OWNERS
  27. PREUPLOAD.cfg
  28. README.md
  29. 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.