[PATCH libdrm] amdgpu: fix off by one in handle_table_insert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 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 *));
> 

Good catch! Looks like you can add

Bugzilla: https://bugs.freedesktop.org/107552

as well as

Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>

before pushing.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux