+ unsigned len = cursor.image.cmap.len;
+ if ((int)len <= 0)
+ goto out;
+ len *= 2;
+ err = -ENOMEM;
+ red = kmalloc(len, GFP_USER);
+ green = kmalloc(len, GFP_USER);
+ blue = kmalloc(len, GFP_USER);
+ if (!red || !green || !blue)
+ goto out;
+ if (cursor_user.image.cmap.transp) {
+ transp = kmalloc(len, GFP_USER);
+ if (!transp)
+ goto out;
+ }
+ err = -EFAULT;
+ if (copy_from_user(red, cursor_user.image.cmap.red, len))
+ goto out;
+ if (copy_from_user(green, cursor_user.image.cmap.green, len))
+ goto out;
+ if (copy_from_user(blue, cursor_user.image.cmap.blue, len))
+ goto out;
+ if (transp) {
+ if (copy_from_user(transp,
+ cursor_user.image.cmap.transp, len))
+ goto out;
+ }
+ cursor.image.cmap.red = red;
+ cursor.image.cmap.green = green;
+ cursor.image.cmap.blue = blue;
+ cursor.image.cmap.transp = transp;