diff options
author | Lingfeng Yang <lfy@google.com> | 2020-08-26 17:03:15 -0700 |
---|---|---|
committer | Lingfeng Yang <lfy@google.com> | 2020-08-26 20:09:17 -0700 |
commit | 85dfc611a7e29547287ce31119e31c17f55dd510 (patch) | |
tree | c9edffffb01981e37e6834dfedc63f42e938d01d | |
parent | 1e04835f3deeab8af34990d649424321ec5fc793 (diff) | |
download | device_generic_goldfish-opengl-85dfc611a7e29547287ce31119e31c17f55dd510.tar.gz device_generic_goldfish-opengl-85dfc611a7e29547287ce31119e31c17f55dd510.tar.bz2 device_generic_goldfish-opengl-85dfc611a7e29547287ce31119e31c17f55dd510.zip |
memset all drm_virtgpu_map structs to 0 before using
Change-Id: I627c64d4760ca465541f2d5fec69f3c88c4fc336
4 files changed, 18 insertions, 17 deletions
diff --git a/shared/GoldfishAddressSpace/include/goldfish_address_space_android.impl b/shared/GoldfishAddressSpace/include/goldfish_address_space_android.impl index a8a70af3..e6f7539a 100644 --- a/shared/GoldfishAddressSpace/include/goldfish_address_space_android.impl +++ b/shared/GoldfishAddressSpace/include/goldfish_address_space_android.impl @@ -619,9 +619,9 @@ bool virtgpu_address_space_create_context_with_subdevice( return false; } - drm_virtgpu_map map = { - .handle = create.bo_handle, - }; + drm_virtgpu_map map; + memset(&map, 0, sizeof(map)); + map.handle = create.bo_handle; ret = drmIoctl(fd, DRM_IOCTL_VIRTGPU_MAP, &map); if (ret) { @@ -694,18 +694,18 @@ bool virtgpu_address_space_allocate_hostmem( abort(); } - struct drm_virtgpu_map map_info = { - .handle = drm_rc_blob.bo_handle, - }; + drm_virtgpu_map map; + memset(&map, 0, sizeof(map)); + map.handle = drm_rc_blob.bo_handle; - res = drmIoctl(fd, DRM_IOCTL_VIRTGPU_MAP, &map_info); + res = drmIoctl(fd, DRM_IOCTL_VIRTGPU_MAP, &map); if (res) { ALOGE("%s: Failed to virtgpu map: sterror: %s errno: %d\n", __func__, strerror(errno), errno); abort(); } - void* directMappedAddr = mmap64(0, size, PROT_WRITE, MAP_SHARED, fd, map_info.offset); + void* directMappedAddr = mmap64(0, size, PROT_WRITE, MAP_SHARED, fd, map.offset); if (!directMappedAddr) { ALOGE("%s: mmap of virtio gpu resource failed\n", __func__); diff --git a/system/OpenglSystemCommon/VirtioGpuPipeStream.cpp b/system/OpenglSystemCommon/VirtioGpuPipeStream.cpp index 238d5559..6143bd53 100644 --- a/system/OpenglSystemCommon/VirtioGpuPipeStream.cpp +++ b/system/OpenglSystemCommon/VirtioGpuPipeStream.cpp @@ -120,9 +120,9 @@ int VirtioGpuPipeStream::connect(const char* serviceName) } if (!m_virtio_mapped) { - drm_virtgpu_map map = { - .handle = m_virtio_bo, - }; + drm_virtgpu_map map; + memset(&map, 0, sizeof(map)); + map.handle = m_virtio_bo; int ret = drmIoctl(m_fd, DRM_IOCTL_VIRTGPU_MAP, &map); if (ret) { diff --git a/system/OpenglSystemCommon/VirtioGpuStream.cpp b/system/OpenglSystemCommon/VirtioGpuStream.cpp index 1b49244c..bbf9dd23 100644 --- a/system/OpenglSystemCommon/VirtioGpuStream.cpp +++ b/system/OpenglSystemCommon/VirtioGpuStream.cpp @@ -149,9 +149,10 @@ int VirtioGpuStream::connect() } if (!m_cmdResp) { - drm_virtgpu_map map = { - .handle = m_cmdResp_bo, - }; + drm_virtgpu_map map; + memset(&map, 0, sizeof(map)); + map.handle = m_cmdResp_bo; + int ret = drmIoctl(m_fd, DRM_IOCTL_VIRTGPU_MAP, &map); if (ret) { ERR("%s: failed with %d mapping command response buffer (%s)", diff --git a/system/vulkan_enc/ResourceTracker.cpp b/system/vulkan_enc/ResourceTracker.cpp index 55394b26..bbd755ce 100644 --- a/system/vulkan_enc/ResourceTracker.cpp +++ b/system/vulkan_enc/ResourceTracker.cpp @@ -2102,9 +2102,9 @@ public: abort(); } - struct drm_virtgpu_map map_info = { - .handle = drm_rc_blob.bo_handle, - }; + drm_virtgpu_map map_info; + memset(&map_info, 0, sizeof(map_info)); + map_info.handle = drm_rc_blob.bo_handle; res = drmIoctl(mRendernodeFd, DRM_IOCTL_VIRTGPU_MAP, &map_info); if (res) { |