Port DirectBuffer trick from ScrubDroid

Signed-off-by: Olivier Mehani <olivier.mehani@nicta.com.au>