PR #47767: lite: nnapi: Check memory mapping errors after NNMemory()
PR #47767: lite: nnapi: Check memory mapping errors after NNMemory()

Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/47767

There are no error checks in the constructor `NNMemory::NNMemory()`.
When creating a shared memory fd, `NNMemory::fd_` could be set to a
negative value due to errors. Thus, when trying to `mmap` this,
`NNMemory::data_ptr_` will be set to `MAP_FAILED` (and which in turn
will yield an invalid call to `ANeuralNetworksMemory_createFromFd()`)...

PiperOrigin-RevId: 363928920
Change-Id: Ic17cf085ddc5d68a6c8d9a78bb46cff7ff24e0bd

paolodedios/tensorflow,petewarden/tensorflow,gautam1858/tensorflow,karllessard/tensorflow,yongtang/tensorflow,sarvex/tensorflow,sarvex/tensorflow,frreiss/tensorflow-fred,Intel-tensorflow/tensorflow,yongtang/tensorflow,sarvex/tensorflow,paolodedios/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,frreiss/tensorflow-fred,tensorflow/tensorflow,frreiss/tensorflow-fred,frreiss/tensorflow-fred,paolodedios/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_saved_model,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_saved_model,frreiss/tensorflow-fred,gautam1858/tensorflow,Intel-Corporation/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_tf_optimizer,frreiss/tensorflow-fred,gautam1858/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,yongtang/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,petewarden/tensorflow,paolodedios/tensorflow,Intel-tensorflow/tensorflow,karllessard/tensorflow,yongtang/tensorflow,petewarden/tensorflow,petewarden/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow,paolodedios/tensorflow,frreiss/tensorflow-fred,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-tensorflow/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,petewarden/tensorflow,petewarden/tensorflow,yongtang/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,frreiss/tensorflow-fred,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-pywrap_saved_model,Intel-Corporation/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,sarvex/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-pywrap_saved_model,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_saved_model,sarvex/tensorflow,Intel-Corporation/tensorflow,karllessard/tensorflow,gautam1858/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,yongtang/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,karllessard/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,yongtang/tensorflow,tensorflow/tensorflow,sarvex/tensorflow,Intel-tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,yongtang/tensorflow,karllessard/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,karllessard/tensorflow,petewarden/tensorflow,Intel-Corporation/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-Corporation/tensorflow,gautam1858/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,Intel-tensorflow/tensorflow,sarvex/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,petewarden/tensorflow,paolodedios/tensorflow,Intel-Corporation/tensorflow,frreiss/tensorflow-fred,karllessard/tensorflow,Intel-Corporation/tensorflow,karllessard/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_saved_model,sarvex/tensorflow,Intel-tensorflow/tensorflow,Intel-tensorflow/tensorflow,frreiss/tensorflow-fred