accel/amdxdna: Use unsigned long for nr_pages in amdxdna_hmm_register()
Lizhi Hou
maintainerPATCH 9/13 accel/amdxdna: Use unsigned long for nr_pages in amdxdna_hmm_register()
nr_pages is declared as u32 in amdxdna_hmm_register(), which may not be large enough to represent the number of pages for large mappings.
Use unsigned long for nr_pages to avoid potential overflow.
Fixes ac49797c1815 ("accel/amdxdna: Add GEM buffer object management")
Signed-off-by Lizhi Hou <[email protected]>
--- drivers/accel/amdxdna/amdxdna_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/amdxdna/amdxdna_gem.c +1 -1
@@ -351,7 +351,7 @@ static int amdxdna_hmm_register(struct amdxdna_gem_obj *abo,unsigned long len = vma->vm_end - vma->vm_start;unsigned long addr = vma->vm_start;struct amdxdna_umap *mapp; -u32 nr_pages; +unsigned long nr_pages;int ret;if (!amdxdna_pasid_on (abo->client)) {
Signature · 1 line
2.34.1
Quoted 7 lines · Lizhi Hou
nr_pagesis declared as u32 inamdxdna_hmm_register(), which may not be large enough to represent the number of pages for large mappings.Use unsigned long for
nr_pagesto avoid potential overflow.Fixes ac49797c1815 ("accel/amdxdna: Add GEM buffer object management")Signed-off-by Lizhi Hou <[email protected]>
Reviewed-by Max Zhen <[email protected]>> ---
Quoted 16 lines
drivers/accel/amdxdna/amdxdna_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/accel/amdxdna/amdxdna_gem.c +1
-1@@ -351,7 +351,7 @@ static int amdxdna_hmm_register(struct amdxdna_gem_obj *abo,unsigned long len = vma->vm_end - vma->vm_start;unsigned long addr = vma->vm_start;struct amdxdna_umap *mapp; -u32 nr_pages; +unsigned long nr_pages;int ret;if (!amdxdna_pasid_on (abo->client)) {
Applied to drm-misc-fixes
Quoted 28 lines · Max Zhen
Quoted 7 lines · Lizhi Hou
nr_pagesis declared as u32 inamdxdna_hmm_register(), which may not be large enough to represent the number of pages for large mappings.Use unsigned long for
nr_pagesto avoid potential overflow.Fixes ac49797c1815 ("accel/amdxdna: Add GEM buffer object management")Signed-off-by Lizhi Hou <[email protected]>Reviewed-by Max Zhen <[email protected]>> ---Quoted 16 lines
drivers/accel/amdxdna/amdxdna_gem.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/accel/amdxdna/amdxdna_gem.c +1
-1@@ -351,7 +351,7 @@ static int amdxdna_hmm_register(structamdxdna_gem_obj *abo, unsigned long len = vma->vm_end - vma->vm_start; unsigned long addr = vma->vm_start; struct amdxdna_umap *mapp; - u32 nr_pages; + unsigned long nr_pages; int ret; if (!amdxdna_pasid_on(abo->client)) {