mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-26 12:10:22 +01:00
aco: fix descriptor leaking when printing assembly with CLRX
This can explode the maximum number of descriptors.
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31344>
(cherry picked from commit 087ef34b9c)
This commit is contained in:
parent
c56802bf6f
commit
dbee14f095
2 changed files with 7 additions and 5 deletions
|
|
@ -394,7 +394,7 @@
|
|||
"description": "aco: fix descriptor leaking when printing assembly with CLRX",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ print_asm_clrx(Program* program, std::vector<uint32_t>& binary, unsigned exec_si
|
|||
#else
|
||||
char path[] = "/tmp/fileXXXXXX";
|
||||
char line[2048], command[128];
|
||||
bool ret = false;
|
||||
FILE* p;
|
||||
int fd;
|
||||
|
||||
|
|
@ -172,8 +173,10 @@ print_asm_clrx(Program* program, std::vector<uint32_t>& binary, unsigned exec_si
|
|||
return true;
|
||||
|
||||
for (unsigned i = 0; i < exec_size; i++) {
|
||||
if (write(fd, &binary[i], 4) == -1)
|
||||
if (write(fd, &binary[i], 4) == -1) {
|
||||
ret = true;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(command, "clrxdisasm --gpuType=%s -r %s", gpu_type, path);
|
||||
|
|
@ -183,6 +186,7 @@ print_asm_clrx(Program* program, std::vector<uint32_t>& binary, unsigned exec_si
|
|||
if (!fgets(line, sizeof(line), p)) {
|
||||
fprintf(output, "clrxdisasm not found\n");
|
||||
pclose(p);
|
||||
ret = true;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -239,12 +243,10 @@ print_asm_clrx(Program* program, std::vector<uint32_t>& binary, unsigned exec_si
|
|||
print_constant_data(output, program);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
fail:
|
||||
close(fd);
|
||||
unlink(path);
|
||||
return true;
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue