提交 dad07ca7 编写于 作者: A Andres Salomon 提交者: Dave Airlie

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: NAndres Salomon <dilinger@collabora.co.uk>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 140a45fc
......@@ -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;
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册