[PATCH] m68k: amifb __user annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Al Viro and committed by Linus Torvalds 3728d254 d85f6891

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