fd/replay: Fix wrbuffer name extraction

The offset for reading and length calculation logic was incorrect
leading to the name string being entirely incorrect.

Signed-off-by: Mark Collins <mark@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28253>
This commit is contained in:
Mark Collins 2024-03-18 10:56:30 +00:00 committed by Marge Bot
parent 1e27138588
commit d043ebc941

View file

@ -1300,8 +1300,9 @@ override_cmdstream(struct device *dev, struct cmdstream *cs,
uint64_t *p = (uint64_t *)ps.buf;
wrbuf->iova = p[0];
wrbuf->size = p[1];
wrbuf->name = calloc(1, p[2]);
memcpy(wrbuf->name, (char *)ps.buf + 3 * sizeof(uint64_t), p[2]);
int name_len = ps.sz - (2 * sizeof(uint64_t));
wrbuf->name = calloc(sizeof(char), name_len);
memcpy(wrbuf->name, (char*)(p + 2), name_len); // includes null terminator
break;
}
default: