vserver 1.9.5.x5
[linux-2.6.git] / drivers / video / sbuslib.c
index c1ab754..70e875a 100644 (file)
@@ -52,7 +52,7 @@ int sbusfb_mmap_helper(struct sbus_mmap_map *map,
        off = vma->vm_pgoff << PAGE_SHIFT;
 
        /* To stop the swapper from even considering these pages */
-       vma->vm_flags |= (VM_SHM | VM_IO | VM_LOCKED);
+       vma->vm_flags |= (VM_IO | VM_RESERVED);
        
        /* Each page, see which map applies */
        for (page = 0; page < size; ){
@@ -93,7 +93,7 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
 {
        switch(cmd) {
        case FBIOGTYPE: {
-               struct fbtype *f = (struct fbtype *) arg;
+               struct fbtype __user *f = (struct fbtype __user *) arg;
 
                if (put_user(type, &f->fb_type) ||
                    __put_user(info->var.yres, &f->fb_height) ||
@@ -105,10 +105,13 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
                return 0;
        }
        case FBIOPUTCMAP_SPARC: {
-               struct fbcmap *c = (struct fbcmap *) arg;
+               struct fbcmap __user *c = (struct fbcmap __user *) arg;
                struct fb_cmap cmap;
                u16 red, green, blue;
-               unsigned char *ured, *ugreen, *ublue;
+               u8 red8, green8, blue8;
+               unsigned char __user *ured;
+               unsigned char __user *ugreen;
+               unsigned char __user *ublue;
                int index, count, i;
 
                if (get_user(index, &c->index) ||
@@ -126,23 +129,30 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
                for (i = 0; i < count; i++) {
                        int err;
 
-                       if (get_user(red, &ured[i]) ||
-                           get_user(green, &ugreen[i]) ||
-                           get_user(blue, &ublue[i]))
+                       if (get_user(red8, &ured[i]) ||
+                           get_user(green8, &ugreen[i]) ||
+                           get_user(blue8, &ublue[i]))
                                return -EFAULT;
 
+                       red = red8 << 8;
+                       green = green8 << 8;
+                       blue = blue8 << 8;
+
                        cmap.start = index + i;
-                       err = fb_set_cmap(&cmap, 0, info);
+                       err = fb_set_cmap(&cmap, info);
                        if (err)
                                return err;
                }
                return 0;
        }
        case FBIOGETCMAP_SPARC: {
-               struct fbcmap *c = (struct fbcmap *) arg;
-               unsigned char *ured, *ugreen, *ublue;
+               struct fbcmap __user *c = (struct fbcmap __user *) arg;
+               unsigned char __user *ured;
+               unsigned char __user *ugreen;
+               unsigned char __user *ublue;
                struct fb_cmap *cmap = &info->cmap;
                int index, count, i;
+               u8 red, green, blue;
 
                if (get_user(index, &c->index) ||
                    __get_user(count, &c->count) ||
@@ -155,9 +165,12 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
                        return -EINVAL;
 
                for (i = 0; i < count; i++) {
-                       if (put_user(cmap->red[index + i], &ured[i]) ||
-                           put_user(cmap->green[index + i], &ugreen[i]) ||
-                           put_user(cmap->blue[index + i], &ublue[i]))
+                       red = cmap->red[index + i] >> 8;
+                       green = cmap->green[index + i] >> 8;
+                       blue = cmap->blue[index + i] >> 8;
+                       if (put_user(red, &ured[i]) ||
+                           put_user(green, &ugreen[i]) ||
+                           put_user(blue, &ublue[i]))
                                return -EFAULT;
                }
                return 0;