int can_ioctl( __LDDK_IOCTL_PARAM ) { void *argp; int retval = -EIO; DBGin("can_ioctl"); DBGprint(DBG_DATA,("cmd=%d", cmd)); Can_errno = 0; switch(cmd){ case COMMAND: if( !access_ok(VERIFY_READ, (void *)arg, sizeof(Command_par_t))) { DBGout(); return(retval); } if( !access_ok(VERIFY_WRITE, (void *)arg, sizeof(Command_par_t))) { DBGout(); return(retval); } argp = (void *) kmalloc( sizeof(Command_par_t) +1 , GFP_KERNEL ); __lddk_copy_from_user( (void *) argp,(Command_par_t *) arg, sizeof(Command_par_t)); ((Command_par_t *) argp)->retval = can_Command(inode, ((Command_par_t *) argp)->cmd ); ((Command_par_t *) argp)->error = Can_errno; __lddk_copy_to_user( (Command_par_t *)arg, (void *)argp, sizeof(Command_par_t)); kfree(argp); break;