public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpu/drm/radeon/radeon_irq.c: move a dereference below a
@ 2009-12-30  1:16 Darren Jenkins
  0 siblings, 0 replies; only message in thread
From: Darren Jenkins @ 2009-12-30  1:16 UTC (permalink / raw)
  To: David Airlie, dri-devel mailing list, Kernel Janitors
  Cc: Linux Kernel Mailing List

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


Coverity CID: 13338

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com> 

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))) {



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-12-30  1:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-30  1:16 [PATCH] gpu/drm/radeon/radeon_irq.c: move a dereference below a Darren Jenkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox