diff options
author | Andres Salomon <dilinger@collabora.co.uk> | 2009-11-17 14:41:25 -0800 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-11-18 10:02:50 +1000 |
commit | dad07ca71719598bc990dbdbeda763d15a10e98b (patch) | |
tree | 8813ec8942e60407663875f37ec862633de84481 | |
parent | 140a45fc3253746e1e42feafc63509df5d90889e (diff) | |
download | blackbird-op-linux-dad07ca71719598bc990dbdbeda763d15a10e98b.tar.gz blackbird-op-linux-dad07ca71719598bc990dbdbeda763d15a10e98b.zip |
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>
-rw-r--r-- | drivers/gpu/drm/drm_drv.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index ec0e3ae8c09d..5bd3f9461e2d 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; } /** |