2009-12-24 12:44:26

by Darren Jenkins

[permalink] [raw]
Subject: drivers/gpu/drm/radeon: move a dereference below a NULL test

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

Signed-off-by: Darren Jenkins <[email protected]>
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))) {


2009-12-25 10:22:40

by Julien Cristau

[permalink] [raw]
Subject: Re: drivers/gpu/drm/radeon: move a dereference below a NULL test

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 <[email protected]>
> 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