On 08/15/2018 07:25 PM, Christian König wrote: > Stupid me, max_key must always be larger than key. > > Signed-off-by: Christian König <christian.koenig at amd.com> Good catch Reviewed-by: Junwei Zhang <Jerry.Zhang at amd.com> > --- > amdgpu/handle_table.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/amdgpu/handle_table.c b/amdgpu/handle_table.c > index 15cd4763..4fdd29d3 100644 > --- a/amdgpu/handle_table.c > +++ b/amdgpu/handle_table.c > @@ -33,7 +33,7 @@ drm_private int handle_table_insert(struct handle_table *table, uint32_t key, > { > if (key >= table->max_key) { > 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; > > values = realloc(table->values, max_key * sizeof(void *)); >