All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm] amdgpu: fix off by one in handle_table_insert
@ 2018-08-15 11:25 Christian König
       [not found] ` <20180815112555.3240-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2018-08-15 11:25 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Stupid me, max_key must always be larger than key.

Signed-off-by: Christian König <christian.koenig@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 *));
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-16  0:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-15 11:25 [PATCH libdrm] amdgpu: fix off by one in handle_table_insert Christian König
     [not found] ` <20180815112555.3240-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-15 13:58   ` Michel Dänzer
2018-08-16  0:50   ` Zhang, Jerry (Junwei)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.