 if (!type[0]) goto error; 
asmlinkage long sys_add_key(const char __user *_type,			    const char __user *_description,			    const void __user *_payload,			    size_t plen,			    key_serial_t ringid){	struct key *keyring, *key;	char type[32], *description;	void *payload;	long dlen, ret;	ret = -EINVAL;	if (plen > 32767)		goto error;	/* draw all the data into kernel space */	ret = strncpy_from_user(type, _type, sizeof(type) - 1);	if (ret < 0)		goto error;	type[31] = '\0';	if (!type[0])		goto error;	ret = -EPERM;	if (type[0] == '.')		goto error;	ret = -EFAULT;	dlen = strnlen_user(_description, PAGE_SIZE - 1);	if (dlen <= 0)		goto error;	ret = -EINVAL;	if (dlen > PAGE_SIZE - 1)		goto error;	ret = -ENOMEM;	description = kmalloc(dlen + 1, GFP_KERNEL);	if (!description)		goto error;	ret = -EFAULT;	if (copy_from_user(description, _description, dlen + 1) != 0)		goto error2;	/* pull the payload in if one was supplied */	payload = NULL;	if (_payload) {		ret = -ENOMEM;		payload = kmalloc(plen, GFP_KERNEL);		if (!payload)			goto error2;		ret = -EFAULT;		if (copy_from_user(payload, _payload, plen) != 0)			goto error3;	}	/* find the target keyring (which must be writable) */	keyring = lookup_user_key(NULL, ringid, 1, 0, KEY_WRITE);	if (IS_ERR(keyring)) {		ret = PTR_ERR(keyring);		goto error3;	}	/* create or update the requested key and add it to the target	 * keyring */	key = key_create_or_update(keyring, type, description,				   payload, plen, 0);	if (!IS_ERR(key)) {		ret = key->serial;		key_put(key);	}	else {		ret = PTR_ERR(key);	}	key_put(keyring); error3:	kfree(payload); error2:	kfree(description); error:	return ret;} /* end sys_add_key() */
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/1260f801b4e4ba7be200886b4a53d730de05ca19/keyctl.c/clean/security/keys/keyctl.c