amdgpu: fix off by one in handle_table_insert

Stupid me, max_key must always be larger than key.

Signed-off-by: Christian König <christian.koenig@amd.com>
Bugzilla: https://bugs.freedesktop.org/107552
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
main
Christian König 2018-08-15 13:25:14 +02:00
parent 1e12c16d76
commit bc4c9f4422
1 changed files with 1 additions and 1 deletions

View File

@ -33,7 +33,7 @@ drm_private int handle_table_insert(struct handle_table *table, uint32_t key,
{ {
if (key >= table->max_key) { if (key >= table->max_key) {
uint32_t alignment = sysconf(_SC_PAGESIZE) / sizeof(void*); uint32_t alignment = sysconf(_SC_PAGESIZE) / sizeof(void*);
uint32_t max_key = ALIGN(key, alignment); uint32_t max_key = ALIGN(key + 1, alignment);
void **values; void **values;
values = realloc(table->values, max_key * sizeof(void *)); values = realloc(table->values, max_key * sizeof(void *));