int len;  dprintk("RPC: creating %s client for %s (xprt %p)\n", program->name, servname, xprt);  err = -EINVAL; if (!xprt) goto out_err; if (vers >= program->nrvers || !(version = program->version[vers])) goto out_err;  err = -ENOMEM; clnt = (struct rpc_clnt *) kmalloc(sizeof(*clnt), GFP_KERNEL); if (!clnt) goto out_err; memset(clnt, 0, sizeof(*clnt)); atomic_set(&clnt->cl_users, 0); atomic_set(&clnt->cl_count, 1); clnt->cl_parent = clnt;  clnt->cl_server = clnt->cl_inline_name; len = strlen(servname) + 1; if (len > sizeof(clnt->cl_inline_name)) { char *buf = kmalloc(len, GFP_KERNEL); if (buf != 0) clnt->cl_server = buf; else len = sizeof(clnt->cl_inline_name); } strlcpy(clnt->cl_server, servname, len);  clnt->cl_xprt     = xprt; clnt->cl_procinfo = version->procs; clnt->cl_maxproc  = version->nrprocs; clnt->cl_protname = program->name; clnt->cl_pmap	  = &clnt->cl_pmap_default; clnt->cl_port     = xprt->addr.sin_port; clnt->cl_prog     = program->number; clnt->cl_vers     = version->number; clnt->cl_prot     = xprt->prot; clnt->cl_stats    = program->stats; rpc_init_wait_queue(&clnt->cl_pmap_default.pm_bindwait, "bindwait");  if (!clnt->cl_port) clnt->cl_autobind = 1;  clnt->cl_rtt = &clnt->cl_rtt_default; rpc_init_rtt(&clnt->cl_rtt_default, xprt->timeout.to_initval);  err = rpc_setup_pipedir(clnt, program->pipe_dir_name); if (err < 0) goto out_no_path;  err = -ENOMEM; if (!rpcauth_create(flavor, clnt)) { printk(KERN_INFO "RPC: Couldn't create auth handle (flavor %u)\n", flavor); goto out_no_auth; }  /* save the nodename */ clnt->cl_nodelen = strlen(system_utsname.nodename); if (clnt->cl_nodelen > UNX_MAXNODENAME) clnt->cl_nodelen = UNX_MAXNODENAME; memcpy(clnt->cl_nodename, system_utsname.nodename, clnt->cl_nodelen); return clnt;  out_no_auth: rpc_rmdir(clnt->cl_pathname); out_no_path: if (clnt->cl_server != clnt->cl_inline_name) kfree(clnt->cl_server); kfree(clnt); out_err: xprt_destroy(xprt); 
 clnt = rpc_new_client(xprt, servname, info, version, authflavor); if (IS_ERR(clnt)) return clnt; err = rpc_ping(clnt, RPC_TASK_SOFT|RPC_TASK_NOINTR); if (err == 0) return clnt; rpc_shutdown_client(clnt); 
rpc_create_client(struct rpc_xprt *xprt, char *servname,		  struct rpc_program *program, u32 vers,		  rpc_authflavor_t flavor){	struct rpc_version	*version;	struct rpc_clnt		*clnt = NULL;	int err;	int len;	dprintk("RPC: creating %s client for %s (xprt %p)\n",		program->name, servname, xprt);	err = -EINVAL;	if (!xprt)		goto out_err;	if (vers >= program->nrvers || !(version = program->version[vers]))		goto out_err;	err = -ENOMEM;	clnt = (struct rpc_clnt *) kmalloc(sizeof(*clnt), GFP_KERNEL);	if (!clnt)		goto out_err;	memset(clnt, 0, sizeof(*clnt));	atomic_set(&clnt->cl_users, 0);	atomic_set(&clnt->cl_count, 1);	clnt->cl_parent = clnt;	clnt->cl_server = clnt->cl_inline_name;	len = strlen(servname) + 1;	if (len > sizeof(clnt->cl_inline_name)) {		char *buf = kmalloc(len, GFP_KERNEL);		if (buf != 0)			clnt->cl_server = buf;		else			len = sizeof(clnt->cl_inline_name);	}	strlcpy(clnt->cl_server, servname, len);	clnt->cl_xprt     = xprt;	clnt->cl_procinfo = version->procs;	clnt->cl_maxproc  = version->nrprocs;	clnt->cl_protname = program->name;	clnt->cl_pmap	  = &clnt->cl_pmap_default;	clnt->cl_port     = xprt->addr.sin_port;	clnt->cl_prog     = program->number;	clnt->cl_vers     = version->number;	clnt->cl_prot     = xprt->prot;	clnt->cl_stats    = program->stats;	rpc_init_wait_queue(&clnt->cl_pmap_default.pm_bindwait, "bindwait");	if (!clnt->cl_port)		clnt->cl_autobind = 1;	clnt->cl_rtt = &clnt->cl_rtt_default;	rpc_init_rtt(&clnt->cl_rtt_default, xprt->timeout.to_initval);	err = rpc_setup_pipedir(clnt, program->pipe_dir_name);	if (err < 0)		goto out_no_path;	err = -ENOMEM;	if (!rpcauth_create(flavor, clnt)) {		printk(KERN_INFO "RPC: Couldn't create auth handle (flavor %u)\n",				flavor);		goto out_no_auth;	}	/* save the nodename */	clnt->cl_nodelen = strlen(system_utsname.nodename);	if (clnt->cl_nodelen > UNX_MAXNODENAME)		clnt->cl_nodelen = UNX_MAXNODENAME;	memcpy(clnt->cl_nodename, system_utsname.nodename, clnt->cl_nodelen);	return clnt;out_no_auth:	rpc_rmdir(clnt->cl_pathname);out_no_path:	if (clnt->cl_server != clnt->cl_inline_name)		kfree(clnt->cl_server);	kfree(clnt);out_err:	xprt_destroy(xprt);	return ERR_PTR(err);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/5ee0ed7d3ab620a764740fb018f469d45f561931/clnt.c/buggy/net/sunrpc/clnt.c