summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar David Marcec2018-10-12 17:10:41 +1100
committerGravatar David Marcec2018-10-12 17:10:41 +1100
commit4d2de6564f6361f8732f734afdc8cfa74d7530ff (patch)
tree062b866ebd3ea49d007972e8bd402e32f0b40a4a /src
parentPassing an invalid nmap handle to Remap should throw an error (diff)
downloadyuzu-4d2de6564f6361f8732f734afdc8cfa74d7530ff.tar.gz
yuzu-4d2de6564f6361f8732f734afdc8cfa74d7530ff.tar.xz
yuzu-4d2de6564f6361f8732f734afdc8cfa74d7530ff.zip
Returned an error before processing other remaps
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
index 7424fa72f..884837b17 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
@@ -84,7 +84,6 @@ u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output)
84 std::memcpy(entries.data(), input.data(), input.size()); 84 std::memcpy(entries.data(), input.data(), input.size());
85 85
86 auto& gpu = Core::System::GetInstance().GPU(); 86 auto& gpu = Core::System::GetInstance().GPU();
87 bool failed_remap{};
88 for (const auto& entry : entries) { 87 for (const auto& entry : entries) {
89 LOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}", 88 LOG_WARNING(Service_NVDRV, "remap entry, offset=0x{:X} handle=0x{:X} pages=0x{:X}",
90 entry.offset, entry.nvmap_handle, entry.pages); 89 entry.offset, entry.nvmap_handle, entry.pages);
@@ -92,8 +91,8 @@ u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output)
92 auto object = nvmap_dev->GetObject(entry.nvmap_handle); 91 auto object = nvmap_dev->GetObject(entry.nvmap_handle);
93 if (!object) { 92 if (!object) {
94 LOG_CRITICAL(Service_NVDRV, "nvmap {} is an invalid handle!", entry.nvmap_handle); 93 LOG_CRITICAL(Service_NVDRV, "nvmap {} is an invalid handle!", entry.nvmap_handle);
95 failed_remap = true; 94 std::memcpy(output.data(), entries.data(), output.size());
96 continue; 95 return static_cast<u32>(NvErrCodes::InvalidNmapHandle);
97 } 96 }
98 97
99 ASSERT(object->status == nvmap::Object::Status::Allocated); 98 ASSERT(object->status == nvmap::Object::Status::Allocated);
@@ -105,9 +104,6 @@ u32 nvhost_as_gpu::Remap(const std::vector<u8>& input, std::vector<u8>& output)
105 ASSERT(returned == offset); 104 ASSERT(returned == offset);
106 } 105 }
107 std::memcpy(output.data(), entries.data(), output.size()); 106 std::memcpy(output.data(), entries.data(), output.size());
108 if (failed_remap) {
109 return static_cast<u32>(NvErrCodes::InvalidNmapHandle);
110 }
111 return 0; 107 return 0;
112} 108}
113 109