case SIOCGIWPRIV: if(wrq->u.data.pointer) { /* Set the number of ioctl available */ wrq->u.data.length = sizeof(atmel_private_args) / sizeof(atmel_private_args[0]);  /* Copy structure to the user buffer */ if (copy_to_user(wrq->u.data.pointer, (u_char *) atmel_private_args, sizeof(atmel_private_args))) rc = -EFAULT; } break;  
static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd){	int i, rc = 0;	struct atmel_private *priv = netdev_priv(dev);	atmel_priv_ioctl com;	struct iwreq *wrq = (struct iwreq *) rq;	unsigned char *new_firmware;	char domain[REGDOMAINSZ+1];	switch (cmd) {	case SIOCGIWPRIV:		if(wrq->u.data.pointer) {			/* Set the number of ioctl available */			wrq->u.data.length = sizeof(atmel_private_args) / sizeof(atmel_private_args[0]);						/* Copy structure to the user buffer */			if (copy_to_user(wrq->u.data.pointer,					 (u_char *) atmel_private_args,					 sizeof(atmel_private_args)))				rc = -EFAULT;		}		break;	case ATMELIDIFC:		wrq->u.param.value = ATMELMAGIC;				break;		case ATMELFWL:		if (copy_from_user(&com, rq->ifr_data, sizeof(com))) {			rc = -EFAULT;			break;		}		if (!capable(CAP_NET_ADMIN)) {			rc = -EPERM;			break;		}		if (!(new_firmware = kmalloc(com.len, GFP_KERNEL))) {			rc = -ENOMEM;			break;		}		if (copy_from_user(new_firmware, com.data, com.len)) {			kfree(new_firmware);			rc = -EFAULT;			break;		}		if (priv->firmware)			kfree(priv->firmware);				priv->firmware = new_firmware;		priv->firmware_length = com.len;		strncpy(priv->firmware_id, com.id, 31);		priv->firmware_id[31] = '\0';		break;	case ATMELRD:		if (copy_from_user(domain, rq->ifr_data, REGDOMAINSZ)) {			rc = -EFAULT;			break;		}				if (!capable(CAP_NET_ADMIN)) {			rc = -EPERM;			break;		}		domain[REGDOMAINSZ] = 0;		rc = -EINVAL;		for (i = 0; i < sizeof(channel_table)/sizeof(channel_table[0]); i++) {			/* strcasecmp doesn't exist in the library */			char *a = channel_table[i].name;			char *b = domain;			while (*a) {				char c1 = *a++;				char c2 = *b++;				if (tolower(c1) != tolower(c2))					break;			}			if (!*a && !*b) {				priv->config_reg_domain = channel_table[i].reg_domain;				rc = 0;			}		}				if (rc == 0 &&  priv->station_state != STATION_STATE_DOWN)			rc = atmel_open(dev);		break;			default:		rc = -EOPNOTSUPP;	}		return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/72f98d38a890822cf547f94c8fbdef591b082ec2/atmel.c/buggy/drivers/net/wireless/atmel.c