* [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
* Re: [PATCH libdrm] amdgpu: fix off by one in handle_table_insert
[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)
1 sibling, 0 replies; 3+ messages in thread
From: Michel Dänzer @ 2018-08-15 13:58 UTC (permalink / raw)
To: Christian König; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
On 2018-08-15 01:25 PM, Christian König wrote:
> 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 *));
>
Good catch! Looks like you can add
Bugzilla: https://bugs.freedesktop.org/107552
as well as
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
before pushing.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH libdrm] amdgpu: fix off by one in handle_table_insert
[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)
1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Jerry (Junwei) @ 2018-08-16 0:50 UTC (permalink / raw)
To: Christian König, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
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@amd.com>
Good catch
Reviewed-by: Junwei Zhang <Jerry.Zhang@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 *));
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [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.