From: Andres Salomon <[email protected]> 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 <[email protected]> Cc: Dave Airlie <[email protected]> Signed-off-by: Andrew Morton <[email protected]> --- drivers/gpu/drm/drm_drv.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff -puN drivers/gpu/drm/drm_drv.c~drm-check-return-values-in-drm_version drivers/gpu/drm/drm_drv.c --- a/drivers/gpu/drm/drm_drv.c~drm-check-return-values-in-drm_version +++ a/drivers/gpu/drm/drm_drv.c @@ -403,15 +403,21 @@ static int drm_version(struct drm_device 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); + 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 0; + return err; } /** _ ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july -- _______________________________________________ Dri-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/dri-devel
