Skip to contentSkip to conversation

gpu/drm/radeon:Fix null pointer risk

PATCH 温志伟 2 participants 2 messages Dec 31, 2021 – Jan 1, 2022

lore
Share & tools
lore

温志伟

author
#0 lore raw


Then the judgment in line 944 is needed. Are the possibilities of these two positions consistent. Why keep this judgment?

Regards,
Wen Zhiwei.

   ----

       主 题:Re: [PATCH] gpu/drm/radeon:Fix null pointer risk
日 期:2021-12-31 00:36
发件人:Christian König
收件人:Wen [email protected]@[email protected]@ffwll.ch Am 28.12.21 um 08:31 schrieb Wen Zhiwei:

Quoted 3 lines

If the null pointer is not judged in advance,
there is a risk that the pointer will cross
the boundary

As far as I can see that case is impossible, why do you want to add a check for it?

Regards,
Christian.

Quoted 19 lines
Signed-off-by Wen Zhiwei

---
  drivers/gpu/drm/radeon/radeon_vm.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_vm.c +0 -0
index bb53016f3138..d3d342041adf 100644
@@ -951,7 +951,7 @@ int radeon_vm_bo_update(struct radeon_device *rdev,


  if (mem->mem_type == TTM_PL_TT) {
  bo_va->flags |= RADEON_VM_PAGE_SYSTEM;
- if (!(bo_va->bo->flags & (RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC)))
+ if (bo_va->bo && !(bo_va->bo->flags & (RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC))) bo_va->flags |= RADEON_VM_PAGE_SNOOPED;

  } else {

#1 lore raw

Am 31.12.21 um 09:37 schrieb 温志伟:

Quoted 7 lines

Then the judgment in line 944 is needed. Are the possibilities of these two positions consistent.

Why keep this judgment?

Because when mem is non-NULL bo_va->bo can't be NULL either.

Regards,
Christian.

Quoted 51 lines

Regards,

Wen Zhiwei.

----

*主 题:*Re: [PATCH] gpu/drm/radeon:Fix null pointer risk
*日 期:*2021-12-31 00:36
*发件人:*Christian König
*收件人:*Wen [email protected]@[email protected]@ffwll.ch

Am 28.12.21 um 08:31 schrieb Wen Zhiwei:

Quoted 3 lines

If the null pointer is not judged in advance,
there is a risk that the pointer will cross
the boundary

As far as I can see that case is impossible, why do you want to add a check for it?

Regards,
Christian.

Review

Quoted 7 lines
Signed-off-by Wen Zhiwei

---
  drivers/gpu/drm/radeon/radeon_vm.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/radeon/radeon_vm.c

drivers/gpu/drm/radeon/radeon_vm.c int radeon_vm_bo_update(struct radeon_device *rdev, · line 954

Quoted 9 lines

index bb53016f3138..d3d342041adf 100644

drivers/gpu/drm/radeon/radeon_vm.c +1 -1
@@ -951,7 +951,7 @@ int radeon_vm_bo_update(struct radeon_device *rdev,
 
   if (mem->mem_type == TTM_PL_TT) {
   bo_va->flags |= RADEON_VM_PAGE_SYSTEM;
- if (!(bo_va->bo->flags & (RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC)))
+ if (bo_va->bo && !(bo_va->bo->flags & (RADEON_GEM_GTT_WC | 

RADEON_GEM_GTT_UC)))

Quoted 3 lines
drivers/gpu/drm/radeon/radeon_vm.c +0 -0
   bo_va->flags |= RADEON_VM_PAGE_SNOOPED;
 
   } else {