[PATCH] gpu/drm/radeon/radeon_irq.c: move a dereference below aNULL test

From: Darren Jenkins
Date: Tue Dec 29 2009 - 20:16:48 EST


If a NULL value is possible, the dereference should only occur after the
NULL test.


Coverity CID: 13338

Signed-off-by: Darren Jenkins <darrenrjenkins@xxxxxxxxx>

diff --git drivers/gpu/drm/radeon/radeon_irq.c drivers/gpu/drm/radeon/radeon_irq.c
index b79ecc4..2f349a3 100644
--- drivers/gpu/drm/radeon/radeon_irq.c
+++ drivers/gpu/drm/radeon/radeon_irq.c
@@ -289,16 +289,16 @@ int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_pr
drm_radeon_irq_emit_t *emit = data;
int result;

- if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
- return -EINVAL;
-
- LOCK_TEST_WITH_RETURN(dev, file_priv);
-
if (!dev_priv) {
DRM_ERROR("called with no initialization\n");
return -EINVAL;
}

+ if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
+ return -EINVAL;
+
+ LOCK_TEST_WITH_RETURN(dev, file_priv);
+
result = radeon_emit_irq(dev);

if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/