From 03dd4cb26d967f9588437b0fc9cc0e8353322bb7 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Fri, 25 Mar 2016 03:53:42 -0300 Subject: Linux-libre 4.5-gnu --- drivers/gpu/drm/nouveau/nouveau_usif.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'drivers/gpu/drm/nouveau/nouveau_usif.c') diff --git a/drivers/gpu/drm/nouveau/nouveau_usif.c b/drivers/gpu/drm/nouveau/nouveau_usif.c index 6ae1b3494..e9f52ef0b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_usif.c +++ b/drivers/gpu/drm/nouveau/nouveau_usif.c @@ -130,20 +130,21 @@ usif_notify_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) struct nvif_notify_req_v0 v0; } *req; struct usif_notify *ntfy; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { if (usif_notify_find(f, args->v0.index)) return -EEXIST; } else return ret; req = data; + ret = -ENOSYS; if (!(ntfy = kmalloc(sizeof(*ntfy), GFP_KERNEL))) return -ENOMEM; atomic_set(&ntfy->enabled, 0); - if (nvif_unpack(req->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, req->v0, 0, 0, true))) { ntfy->reply = sizeof(struct nvif_notify_rep_v0) + req->v0.reply; ntfy->route = req->v0.route; ntfy->token = req->v0.token; @@ -171,9 +172,9 @@ usif_notify_del(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) struct nvif_ioctl_ntfy_del_v0 v0; } *args = data; struct usif_notify *ntfy; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { if (!(ntfy = usif_notify_find(f, args->v0.index))) return -ENOENT; } else @@ -194,9 +195,9 @@ usif_notify_get(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) struct nvif_ioctl_ntfy_del_v0 v0; } *args = data; struct usif_notify *ntfy; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { if (!(ntfy = usif_notify_find(f, args->v0.index))) return -ENOENT; } else @@ -233,9 +234,9 @@ usif_notify_put(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) struct nvif_ioctl_ntfy_put_v0 v0; } *args = data; struct usif_notify *ntfy; - int ret; + int ret = -ENOSYS; - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { if (!(ntfy = usif_notify_find(f, args->v0.index))) return -ENOENT; } else @@ -270,13 +271,13 @@ usif_object_new(struct drm_file *f, void *data, u32 size, void *argv, u32 argc) struct nvif_ioctl_new_v0 v0; } *args = data; struct usif_object *object; - int ret; + int ret = -ENOSYS; if (!(object = kmalloc(sizeof(*object), GFP_KERNEL))) return -ENOMEM; list_add(&object->head, &cli->objects); - if (nvif_unpack(args->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { object->route = args->v0.route; object->token = args->v0.token; args->v0.route = NVDRM_OBJECT_USIF; @@ -310,7 +311,7 @@ usif_ioctl(struct drm_file *filp, void __user *user, u32 argc) if (ret = -EFAULT, copy_from_user(argv, user, size)) goto done; - if (nvif_unpack(argv->v0, 0, 0, true)) { + if (!(ret = nvif_unpack(-ENOSYS, &data, &size, argv->v0, 0, 0, true))) { /* block access to objects not created via this interface */ owner = argv->v0.owner; if (argv->v0.object == 0ULL) -- cgit v1.2.3-54-g00ecf