From aa09e3611490d6a2f12f211c3c834f1237126313 Mon Sep 17 00:00:00 2001 From: Jeff Hartmann Date: Mon, 13 Aug 2001 23:23:47 +0000 Subject: Sync with Linus 2.4.9-pre2 + make all nopage routines more alike --- linux/drm_context.h | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'linux/drm_context.h') diff --git a/linux/drm_context.h b/linux/drm_context.h index 5e54d81a..eb4d61c8 100644 --- a/linux/drm_context.h +++ b/linux/drm_context.h @@ -160,7 +160,7 @@ int DRM(getsareactx)(struct inode *inode, struct file *filp, return -EFAULT; down(&dev->struct_sem); - if ((int)request.ctx_id >= dev->max_context) { + if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) { up(&dev->struct_sem); return -EINVAL; } @@ -193,22 +193,20 @@ int DRM(setsareactx)(struct inode *inode, struct file *filp, list_for_each(list, &dev->maplist->head) { r_list = (drm_map_list_t *)list; if(r_list->map && - r_list->map->handle == request.handle) break; + r_list->map->handle == request.handle) + goto found; } - if (list == &(dev->maplist->head)) { - up(&dev->struct_sem); - return -EINVAL; - } - map = r_list->map; +bad: up(&dev->struct_sem); + return -EINVAL; - if (!map) return -EINVAL; - - down(&dev->struct_sem); - if ((int)request.ctx_id >= dev->max_context) { - up(&dev->struct_sem); - return -EINVAL; - } +found: + map = r_list->map; + if (!map) goto bad; + if (dev->max_context < 0) + goto bad; + if (request.ctx_id >= (unsigned) dev->max_context) + goto bad; dev->context_sareas[request.ctx_id] = map; up(&dev->struct_sem); return 0; -- cgit v1.2.3