LKML Archive mirror
 help / color / mirror / Atom feed
* drivers/gpu/drm/radeon: move a dereference below a NULL test
@ 2009-12-24 12:44 Darren Jenkins
  2009-12-25 10:13 ` Julien Cristau
  0 siblings, 1 reply; 2+ messages in thread
From: Darren Jenkins @ 2009-12-24 12:44 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.

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
diff --git a/drivers/gpu/drm/radeon/radeon_irq.c
b/drivers/gpu/drm/radeon/radeon_irq.c
index b79ecc4..2f349a3 100644
--- a/drivers/gpu/drm/radeon/radeon_irq.c
+++ b/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] 2+ messages in thread

* Re: drivers/gpu/drm/radeon: move a dereference below a NULL test
  2009-12-24 12:44 drivers/gpu/drm/radeon: move a dereference below a NULL test Darren Jenkins
@ 2009-12-25 10:13 ` Julien Cristau
  0 siblings, 0 replies; 2+ messages in thread
From: Julien Cristau @ 2009-12-25 10:13 UTC (permalink / raw
  To: Darren Jenkins
  Cc: David Airlie, dri-devel mailing list, Kernel Janitors,
	Linux Kernel Mailing List

On Thu, Dec 24, 2009 at 23:44:30 +1100, Darren Jenkins wrote:

> If a NULL value is possible, the dereference should only occur after the
> NULL test.
> 
> Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
> diff --git a/drivers/gpu/drm/radeon/radeon_irq.c
> b/drivers/gpu/drm/radeon/radeon_irq.c
> index b79ecc4..2f349a3 100644
> --- a/drivers/gpu/drm/radeon/radeon_irq.c
> +++ b/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

Looks like your patches are whitespace-damaged.  You'll need to fix your
MUA...

Cheers,
Julien

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-25 10:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-24 12:44 drivers/gpu/drm/radeon: move a dereference below a NULL test Darren Jenkins
2009-12-25 10:13 ` Julien Cristau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).