summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_drv.c
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@collabora.co.uk>2009-11-17 14:41:25 -0800
committerDave Airlie <airlied@redhat.com>2009-11-18 10:02:50 +1000
commitdad07ca71719598bc990dbdbeda763d15a10e98b (patch)
tree8813ec8942e60407663875f37ec862633de84481 /drivers/gpu/drm/drm_drv.c
parent140a45fc3253746e1e42feafc63509df5d90889e (diff)
drm: check return values in drm_version
In drm_version, actually check the results from function calls so that we're not potentially passing garbage back to userspace. Signed-off-by: Andres Salomon <dilinger@collabora.co.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_drv.c')
-rw-r--r--drivers/gpu/drm/drm_drv.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index ec0e3ae8c09..5bd3f9461e2 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -403,15 +403,21 @@ static int drm_version(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_version *version = data;
+ int err;
version->version_major = dev->driver->major;
version->version_minor = dev->driver->minor;
version->version_patchlevel = dev->driver->patchlevel;
- drm_copy_field(version->name, &version->name_len, dev->driver->name);
- drm_copy_field(version->date, &version->date_len, dev->driver->date);
- drm_copy_field(version->desc, &version->desc_len, dev->driver->desc);
-
- return 0;
+ err = drm_copy_field(version->name, &version->name_len,
+ dev->driver->name);
+ if (!err)
+ err = drm_copy_field(version->date, &version->date_len,
+ dev->driver->date);
+ if (!err)
+ err = drm_copy_field(version->desc, &version->desc_len,
+ dev->driver->desc);
+
+ return err;
}
/**