diff options
author | Andres Salomon <dilinger@collabora.co.uk> | 2009-11-17 17:41:25 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-11-17 19:02:50 -0500 |
commit | dad07ca71719598bc990dbdbeda763d15a10e98b (patch) | |
tree | 8813ec8942e60407663875f37ec862633de84481 /drivers/gpu/drm/drm_drv.c | |
parent | 140a45fc3253746e1e42feafc63509df5d90889e (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.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, | |||
403 | struct drm_file *file_priv) | 403 | struct drm_file *file_priv) |
404 | { | 404 | { |
405 | struct drm_version *version = data; | 405 | struct drm_version *version = data; |
406 | int err; | ||
406 | 407 | ||
407 | version->version_major = dev->driver->major; | 408 | version->version_major = dev->driver->major; |
408 | version->version_minor = dev->driver->minor; | 409 | version->version_minor = dev->driver->minor; |
409 | version->version_patchlevel = dev->driver->patchlevel; | 410 | version->version_patchlevel = dev->driver->patchlevel; |
410 | drm_copy_field(version->name, &version->name_len, dev->driver->name); | 411 | err = drm_copy_field(version->name, &version->name_len, |
411 | drm_copy_field(version->date, &version->date_len, dev->driver->date); | 412 | dev->driver->name); |
412 | drm_copy_field(version->desc, &version->desc_len, dev->driver->desc); | 413 | if (!err) |
413 | 414 | err = drm_copy_field(version->date, &version->date_len, | |
414 | return 0; | 415 | dev->driver->date); |
416 | if (!err) | ||
417 | err = drm_copy_field(version->desc, &version->desc_len, | ||
418 | dev->driver->desc); | ||
419 | |||
420 | return err; | ||
415 | } | 421 | } |
416 | 422 | ||
417 | /** | 423 | /** |