diff options
Diffstat (limited to 'drivers/video/amifb.c')
-rw-r--r-- | drivers/video/amifb.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index 8cfba10f843e..2c42a812655a 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c | |||
@@ -1166,8 +1166,8 @@ static void ami_update_display(void); | |||
1166 | static void ami_init_display(void); | 1166 | static void ami_init_display(void); |
1167 | static void ami_do_blank(void); | 1167 | static void ami_do_blank(void); |
1168 | static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix); | 1168 | static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix); |
1169 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data); | 1169 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data); |
1170 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data); | 1170 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data); |
1171 | static int ami_get_cursorstate(struct fb_cursorstate *state); | 1171 | static int ami_get_cursorstate(struct fb_cursorstate *state); |
1172 | static int ami_set_cursorstate(struct fb_cursorstate *state); | 1172 | static int ami_set_cursorstate(struct fb_cursorstate *state); |
1173 | static void ami_set_sprite(void); | 1173 | static void ami_set_sprite(void); |
@@ -2181,6 +2181,7 @@ static int amifb_ioctl(struct inode *inode, struct file *file, | |||
2181 | struct fb_var_cursorinfo var; | 2181 | struct fb_var_cursorinfo var; |
2182 | struct fb_cursorstate state; | 2182 | struct fb_cursorstate state; |
2183 | } crsr; | 2183 | } crsr; |
2184 | void __user *argp = (void __user *)arg; | ||
2184 | int i; | 2185 | int i; |
2185 | 2186 | ||
2186 | switch (cmd) { | 2187 | switch (cmd) { |
@@ -2188,33 +2189,32 @@ static int amifb_ioctl(struct inode *inode, struct file *file, | |||
2188 | i = ami_get_fix_cursorinfo(&crsr.fix); | 2189 | i = ami_get_fix_cursorinfo(&crsr.fix); |
2189 | if (i) | 2190 | if (i) |
2190 | return i; | 2191 | return i; |
2191 | return copy_to_user((void *)arg, &crsr.fix, | 2192 | return copy_to_user(argp, &crsr.fix, |
2192 | sizeof(crsr.fix)) ? -EFAULT : 0; | 2193 | sizeof(crsr.fix)) ? -EFAULT : 0; |
2193 | 2194 | ||
2194 | case FBIOGET_VCURSORINFO: | 2195 | case FBIOGET_VCURSORINFO: |
2195 | i = ami_get_var_cursorinfo(&crsr.var, | 2196 | i = ami_get_var_cursorinfo(&crsr.var, |
2196 | ((struct fb_var_cursorinfo *)arg)->data); | 2197 | ((struct fb_var_cursorinfo __user *)arg)->data); |
2197 | if (i) | 2198 | if (i) |
2198 | return i; | 2199 | return i; |
2199 | return copy_to_user((void *)arg, &crsr.var, | 2200 | return copy_to_user(argp, &crsr.var, |
2200 | sizeof(crsr.var)) ? -EFAULT : 0; | 2201 | sizeof(crsr.var)) ? -EFAULT : 0; |
2201 | 2202 | ||
2202 | case FBIOPUT_VCURSORINFO: | 2203 | case FBIOPUT_VCURSORINFO: |
2203 | if (copy_from_user(&crsr.var, (void *)arg, | 2204 | if (copy_from_user(&crsr.var, argp, sizeof(crsr.var))) |
2204 | sizeof(crsr.var))) | ||
2205 | return -EFAULT; | 2205 | return -EFAULT; |
2206 | return ami_set_var_cursorinfo(&crsr.var, | 2206 | return ami_set_var_cursorinfo(&crsr.var, |
2207 | ((struct fb_var_cursorinfo *)arg)->data); | 2207 | ((struct fb_var_cursorinfo __user *)arg)->data); |
2208 | 2208 | ||
2209 | case FBIOGET_CURSORSTATE: | 2209 | case FBIOGET_CURSORSTATE: |
2210 | i = ami_get_cursorstate(&crsr.state); | 2210 | i = ami_get_cursorstate(&crsr.state); |
2211 | if (i) | 2211 | if (i) |
2212 | return i; | 2212 | return i; |
2213 | return copy_to_user((void *)arg, &crsr.state, | 2213 | return copy_to_user(argp, &crsr.state, |
2214 | sizeof(crsr.state)) ? -EFAULT : 0; | 2214 | sizeof(crsr.state)) ? -EFAULT : 0; |
2215 | 2215 | ||
2216 | case FBIOPUT_CURSORSTATE: | 2216 | case FBIOPUT_CURSORSTATE: |
2217 | if (copy_from_user(&crsr.state, (void *)arg, | 2217 | if (copy_from_user(&crsr.state, argp, |
2218 | sizeof(crsr.state))) | 2218 | sizeof(crsr.state))) |
2219 | return -EFAULT; | 2219 | return -EFAULT; |
2220 | return ami_set_cursorstate(&crsr.state); | 2220 | return ami_set_cursorstate(&crsr.state); |
@@ -3327,7 +3327,7 @@ static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix) | |||
3327 | return 0; | 3327 | return 0; |
3328 | } | 3328 | } |
3329 | 3329 | ||
3330 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | 3330 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data) |
3331 | { | 3331 | { |
3332 | struct amifb_par *par = ¤tpar; | 3332 | struct amifb_par *par = ¤tpar; |
3333 | register u_short *lspr, *sspr; | 3333 | register u_short *lspr, *sspr; |
@@ -3349,14 +3349,14 @@ static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3349 | var->yspot = par->crsr.spot_y; | 3349 | var->yspot = par->crsr.spot_y; |
3350 | if (size > var->height*var->width) | 3350 | if (size > var->height*var->width) |
3351 | return -ENAMETOOLONG; | 3351 | return -ENAMETOOLONG; |
3352 | if (!access_ok(VERIFY_WRITE, (void *)data, size)) | 3352 | if (!access_ok(VERIFY_WRITE, data, size)) |
3353 | return -EFAULT; | 3353 | return -EFAULT; |
3354 | delta = 1<<par->crsr.fmode; | 3354 | delta = 1<<par->crsr.fmode; |
3355 | lspr = lofsprite + (delta<<1); | 3355 | lspr = lofsprite + (delta<<1); |
3356 | if (par->bplcon0 & BPC0_LACE) | 3356 | if (par->bplcon0 & BPC0_LACE) |
3357 | sspr = shfsprite + (delta<<1); | 3357 | sspr = shfsprite + (delta<<1); |
3358 | else | 3358 | else |
3359 | sspr = 0; | 3359 | sspr = NULL; |
3360 | for (height = (short)var->height-1; height >= 0; height--) { | 3360 | for (height = (short)var->height-1; height >= 0; height--) { |
3361 | bits = 0; words = delta; datawords = 0; | 3361 | bits = 0; words = delta; datawords = 0; |
3362 | for (width = (short)var->width-1; width >= 0; width--) { | 3362 | for (width = (short)var->width-1; width >= 0; width--) { |
@@ -3402,7 +3402,7 @@ static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3402 | return 0; | 3402 | return 0; |
3403 | } | 3403 | } |
3404 | 3404 | ||
3405 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | 3405 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data) |
3406 | { | 3406 | { |
3407 | struct amifb_par *par = ¤tpar; | 3407 | struct amifb_par *par = ¤tpar; |
3408 | register u_short *lspr, *sspr; | 3408 | register u_short *lspr, *sspr; |
@@ -3429,7 +3429,7 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3429 | return -EINVAL; | 3429 | return -EINVAL; |
3430 | if (!var->height) | 3430 | if (!var->height) |
3431 | return -EINVAL; | 3431 | return -EINVAL; |
3432 | if (!access_ok(VERIFY_READ, (void *)data, var->width*var->height)) | 3432 | if (!access_ok(VERIFY_READ, data, var->width*var->height)) |
3433 | return -EFAULT; | 3433 | return -EFAULT; |
3434 | delta = 1<<fmode; | 3434 | delta = 1<<fmode; |
3435 | lofsprite = shfsprite = (u_short *)spritememory; | 3435 | lofsprite = shfsprite = (u_short *)spritememory; |
@@ -3444,13 +3444,13 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3444 | if (((var->height+2)<<fmode<<2) > SPRITEMEMSIZE) | 3444 | if (((var->height+2)<<fmode<<2) > SPRITEMEMSIZE) |
3445 | return -EINVAL; | 3445 | return -EINVAL; |
3446 | memset(lspr, 0, (var->height+2)<<fmode<<2); | 3446 | memset(lspr, 0, (var->height+2)<<fmode<<2); |
3447 | sspr = 0; | 3447 | sspr = NULL; |
3448 | } | 3448 | } |
3449 | for (height = (short)var->height-1; height >= 0; height--) { | 3449 | for (height = (short)var->height-1; height >= 0; height--) { |
3450 | bits = 16; words = delta; datawords = 0; | 3450 | bits = 16; words = delta; datawords = 0; |
3451 | for (width = (short)var->width-1; width >= 0; width--) { | 3451 | for (width = (short)var->width-1; width >= 0; width--) { |
3452 | unsigned long tdata = 0; | 3452 | unsigned long tdata = 0; |
3453 | get_user(tdata, (char *)data); | 3453 | get_user(tdata, data); |
3454 | data++; | 3454 | data++; |
3455 | #ifdef __mc68000__ | 3455 | #ifdef __mc68000__ |
3456 | asm volatile ( | 3456 | asm volatile ( |