Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom 'spot' Callaway <tcallawa@redhat.com>2005-02-11 07:28:08 -0800
committerDavid S. Miller <davem@nuts.davemloft.net>2005-02-11 07:28:08 -0800
commit2a58fce260bd9354e4a367cb96fae88a6d1aa30a (patch)
tree7c399f497d88634717b06b2f307014783a43045a
parent12853bfa0beffd7a27ac3bff9f0677e6e106cb78 (diff)
[SPARC]: fb: Fix putcmap handling in sbuslib
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/video/sbuslib.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c
index 90a61add4077..70e875aaa2f5 100644
--- a/drivers/video/sbuslib.c
+++ b/drivers/video/sbuslib.c
@@ -108,6 +108,7 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
struct fbcmap __user *c = (struct fbcmap __user *) arg;
struct fb_cmap cmap;
u16 red, green, blue;
+ u8 red8, green8, blue8;
unsigned char __user *ured;
unsigned char __user *ugreen;
unsigned char __user *ublue;
@@ -128,11 +129,15 @@ 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, info);
if (err)
@@ -147,6 +152,7 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
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) ||
@@ -159,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;