diff options
author | Siddharth Kapoor <ksiddharth@google.com> | 2022-04-22 16:09:04 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-04-22 16:09:04 +0000 |
commit | de403fbacfcd111c90f0de2a26d6c521361e0505 (patch) | |
tree | fb38f948b621014fb4da8ac0b98b3d3222c348ce | |
parent | 1ef1c97dbace71970cbc4ad1da8608eacbd5b350 (diff) | |
parent | f7650a2d092ea056771dae5dbdc69329376f009c (diff) | |
download | gchips-de403fbacfcd111c90f0de2a26d6c521361e0505.tar.gz |
Revert "Validate alloc_size while mapping a buffer" am: f7650a2d09
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/google/gchips/+/17898284
Change-Id: Ibed46e63a6ec31b0a581ef38db035d8ae504d920
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | gralloc4/src/core/mali_gralloc_reference.cpp | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/gralloc4/src/core/mali_gralloc_reference.cpp b/gralloc4/src/core/mali_gralloc_reference.cpp index b73c08b..954c2b3 100644 --- a/gralloc4/src/core/mali_gralloc_reference.cpp +++ b/gralloc4/src/core/mali_gralloc_reference.cpp @@ -76,16 +76,6 @@ private: return 0; } - for (auto i = 0; i < MAX_BUFFER_FDS; i++) { - auto size = get_buffer_size(hnd->fds[i]); - auto size_padding = size - (off_t)hnd->alloc_sizes[i]; - if ((size != -1) && ((size_padding < 0) || (size_padding > PAGE_SIZE))){ - MALI_GRALLOC_LOGE("Found an imported buffer with out-of-bounds size %" PRIu64 "", - hnd->alloc_sizes[i]); - return -EINVAL; - } - } - int error = mali_gralloc_ion_map(hnd); if (error != 0) { return error; @@ -125,7 +115,7 @@ private: } else { for (auto i = 0; i < MAX_BUFFER_FDS; i++) { if (hnd->bases[i] != 0 || data.bases[i] != nullptr) { - MALI_GRALLOC_LOGE("Validation failed: Expected nullptr for unmapped buffer"); + MALI_GRALLOC_LOGE("Validation failed: Expected nullptr for unmaped buffer"); return -EINVAL; } } @@ -134,13 +124,6 @@ private: return 0; } - off_t get_buffer_size(unsigned int fd) { - off_t current = lseek(fd, 0, SEEK_CUR); - off_t size = lseek(fd, 0, SEEK_END); - lseek(fd, current, SEEK_SET); - return size; - } - public: static BufferManager &getInstance() { static BufferManager instance; |