int err, gfp_mask; 
int err; unsigned int gfp_mask; 
static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,			      char __user *instr_data, long len, int atomic,			      int cmd){	snd_iwffff_ops_t *ops = (snd_iwffff_ops_t *)private_data;	iwffff_instrument_t *ip;	iwffff_xinstrument_t ix;	iwffff_layer_t *lp, *prev_lp;	iwffff_xlayer_t lx;	int err, gfp_mask;	if (cmd != SNDRV_SEQ_INSTR_PUT_CMD_CREATE)		return -EINVAL;	gfp_mask = atomic ? GFP_ATOMIC : GFP_KERNEL;	/* copy instrument data */	if (len < (long)sizeof(ix))		return -EINVAL;	if (copy_from_user(&ix, instr_data, sizeof(ix)))		return -EFAULT;	if (ix.stype != IWFFFF_STRU_INSTR)		return -EINVAL;	instr_data += sizeof(ix);	len -= sizeof(ix);	ip = (iwffff_instrument_t *)KINSTR_DATA(instr);	ip->exclusion = le16_to_cpu(ix.exclusion);	ip->layer_type = le16_to_cpu(ix.layer_type);	ip->exclusion_group = le16_to_cpu(ix.exclusion_group);	ip->effect1 = ix.effect1;	ip->effect1_depth = ix.effect1_depth;	ip->effect2 = ix.effect2;	ip->effect2_depth = ix.effect2_depth;	/* copy layers */	prev_lp = NULL;	while (len > 0) {		if (len < (long)sizeof(iwffff_xlayer_t)) {			snd_seq_iwffff_instr_free(ops, ip, atomic);			return -EINVAL;		}		if (copy_from_user(&lx, instr_data, sizeof(lx)))			return -EFAULT;		instr_data += sizeof(lx);		len -= sizeof(lx);		if (lx.stype != IWFFFF_STRU_LAYER) {			snd_seq_iwffff_instr_free(ops, ip, atomic);			return -EINVAL;		}		lp = kcalloc(1, sizeof(*lp), gfp_mask);		if (lp == NULL) {			snd_seq_iwffff_instr_free(ops, ip, atomic);			return -ENOMEM;		}		if (prev_lp) {			prev_lp->next = lp;		} else {			ip->layer = lp;		}		prev_lp = lp;		lp->flags = lx.flags;		lp->velocity_mode = lx.velocity_mode;		lp->layer_event = lx.layer_event;		lp->low_range = lx.low_range;		lp->high_range = lx.high_range;		lp->pan = lx.pan;		lp->pan_freq_scale = lx.pan_freq_scale;		lp->attenuation = lx.attenuation;		snd_seq_iwffff_copy_lfo_from_stream(&lp->tremolo, &lx.tremolo);		snd_seq_iwffff_copy_lfo_from_stream(&lp->vibrato, &lx.vibrato);		lp->freq_scale = le16_to_cpu(lx.freq_scale);		lp->freq_center = lx.freq_center;		err = snd_seq_iwffff_copy_env_from_stream(IWFFFF_STRU_ENV_RECP,							  lp,							  &lp->penv, &lx.penv,						          &instr_data, &len,						          gfp_mask);		if (err < 0) {			snd_seq_iwffff_instr_free(ops, ip, atomic);			return err;		}		err = snd_seq_iwffff_copy_env_from_stream(IWFFFF_STRU_ENV_RECV,							  lp,							  &lp->venv, &lx.venv,						          &instr_data, &len,						          gfp_mask);		if (err < 0) {			snd_seq_iwffff_instr_free(ops, ip, atomic);			return err;		}		while (len > (long)sizeof(__u32)) {			__u32 stype;			if (copy_from_user(&stype, instr_data, sizeof(stype)))				return -EFAULT;			if (stype != IWFFFF_STRU_WAVE)				break;			err = snd_seq_iwffff_copy_wave_from_stream(ops,								   lp,							    	   &instr_data,								   &len,								   atomic);			if (err < 0) {				snd_seq_iwffff_instr_free(ops, ip, atomic);				return err;			}		}	}	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/5a0f217d96656068f0f1e5cda16c35945f979b16/ainstr_iw.c/buggy/sound/core/seq/instr/ainstr_iw.c