cl_vers, /* RPC version number */
cl_maxproc; /* max procedure number */
- char * cl_server; /* server machine name */
- char * cl_protname; /* protocol name */
+ const char * cl_server; /* server machine name */
+ const char * cl_protname; /* protocol name */
struct rpc_auth * cl_auth; /* authenticator */
struct rpc_stat * cl_stats; /* per-program statistics */
struct rpc_iostats * cl_metrics; /* per-client statistics */
struct rpc_rtt cl_rtt_default;
struct rpc_timeout cl_timeout_default;
struct rpc_program * cl_program;
- char cl_inline_name[32];
char *cl_principal; /* target to authenticate to */
};
unsigned int p_count; /* call count */
unsigned int p_timer; /* Which RTT timer to use */
u32 p_statidx; /* Which procedure to account */
- char * p_name; /* name of procedure */
+ const char * p_name; /* name of procedure */
};
#ifdef __KERNEL__
size_t addrsize;
struct sockaddr *saddress;
const struct rpc_timeout *timeout;
- char *servername;
+ const char *servername;
struct rpc_program *program;
u32 prognumber; /* overrides program->number */
u32 version;
goto out_err;
clnt->cl_parent = clnt;
- clnt->cl_server = clnt->cl_inline_name;
- if (len > sizeof(clnt->cl_inline_name)) {
- char *buf = kmalloc(len, GFP_KERNEL);
- if (buf != NULL)
- clnt->cl_server = buf;
- else
- len = sizeof(clnt->cl_inline_name);
- }
- strlcpy(clnt->cl_server, args->servername, len);
+ clnt->cl_server = kstrdup(args->servername, GFP_KERNEL);
+ if (clnt->cl_server == NULL)
+ goto out_no_server;
clnt->cl_xprt = xprt;
clnt->cl_procinfo = version->procs;
out_no_principal:
rpc_free_iostats(clnt->cl_metrics);
out_no_stats:
- if (clnt->cl_server != clnt->cl_inline_name)
- kfree(clnt->cl_server);
+ kfree(clnt->cl_server);
+out_no_server:
kfree(clnt);
out_err:
xprt_put(xprt);
new = kmemdup(clnt, sizeof(*new), GFP_KERNEL);
if (!new)
goto out_no_clnt;
+ new->cl_server = kstrdup(clnt->cl_server, GFP_KERNEL);
+ if (new->cl_server == NULL)
+ goto out_no_server;
new->cl_parent = clnt;
/* Turn off autobind on clones */
new->cl_autobind = 0;
out_no_principal:
rpc_free_iostats(new->cl_metrics);
out_no_stats:
+ kfree(new->cl_server);
+out_no_server:
kfree(new);
out_no_clnt:
dprintk("RPC: %s: returned error %d\n", __func__, err);
{
dprintk("RPC: destroying %s client for %s\n",
clnt->cl_protname, clnt->cl_server);
- if (clnt->cl_parent != clnt) {
+ if (clnt->cl_parent != clnt)
rpc_release_client(clnt->cl_parent);
- goto out_free;
- }
- if (clnt->cl_server != clnt->cl_inline_name)
- kfree(clnt->cl_server);
-out_free:
+ kfree(clnt->cl_server);
rpc_unregister_client(clnt);
rpc_clnt_remove_pipedir(clnt);
rpc_free_iostats(clnt->cl_metrics);