amdgpu: fix off by one in handle_table_insert
PATCH 1/1 amdgpu: fix off by one in handle_table_insert
Stupid me, max_key must always be larger than key.
--- amdgpu/handle_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
amdgpu/handle_table.c +1 -1
@@ -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 *));
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180815112555.3240-1-christian.koenig-5C7GfCeVMHo@public.gmane.org
Michel Dänzer
Reviewed-byQuoted 13 lines · Christian König
Stupid me,
max_keymust always be larger than key.Signed-off-by Christian König <[email protected]>--- amdgpu/handle_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)amdgpu/handle_table.c +0
-0
amdgpu/handle_table.c drm_private int handle_table_insert(struct handle_table *table, uint32_t key, · line 39
Quoted 8 lines
amdgpu/handle_table.c +1
-1@@ -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 *));
Good catch! Looks like you can add
Bugzilla: https://bugs.freedesktop.org/107552
as well as
before pushing.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Zhang, Jerry (Junwei)
Reviewed-by Junwei ZhangQuoted 3 lines · Christian König
Stupid me,
max_keymust always be larger than key.Signed-off-by Christian König <[email protected]>
Good catch
Quoted 10 lines
--- amdgpu/handle_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)amdgpu/handle_table.c +0
-0
amdgpu/handle_table.c drm_private int handle_table_insert(struct handle_table *table, uint32_t key, · line 39
Quoted 8 lines
amdgpu/handle_table.c +1
-1@@ -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 *));
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx