[PATCH 61/88] drm/amdgpu: fix dereference before check
Alex Deucher
alexdeucher at gmail.com
Tue May 26 20:20:00 PDT 2015
From: Christian König <christian.koenig at amd.com>
Signed-off-by: Christian König <christian.koenig at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou at amd.com>
Reviewed-by: Monk Liu <monk.liu at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
index 66c66f8..74ed94e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c
@@ -138,9 +138,9 @@ void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib)
int amdgpu_ib_schedule(struct amdgpu_device *adev, unsigned num_ibs,
struct amdgpu_ib *ibs, void *owner)
{
- struct amdgpu_ring *ring;
- struct amdgpu_vm *vm = ibs->vm;
struct amdgpu_ib *ib = &ibs[0];
+ struct amdgpu_ring *ring;
+ struct amdgpu_vm *vm;
unsigned i;
int r = 0;
@@ -148,6 +148,8 @@ int amdgpu_ib_schedule(struct amdgpu_device *adev, unsigned num_ibs,
return -EINVAL;
ring = ibs->ring;
+ vm = ibs->vm;
+
if (!ring->ready) {
dev_err(adev->dev, "couldn't schedule ib\n");
return -EINVAL;
--
1.8.3.1
More information about the dri-devel
mailing list