diff options
-rw-r--r-- | net/sunrpc/clnt.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 8d83f9d48713..b91f8f943c5e 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -298,22 +298,21 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
298 | * up a string representation of the passed-in address. | 298 | * up a string representation of the passed-in address. |
299 | */ | 299 | */ |
300 | if (args->servername == NULL) { | 300 | if (args->servername == NULL) { |
301 | struct sockaddr_in *sin = | ||
302 | (struct sockaddr_in *)args->address; | ||
303 | struct sockaddr_in6 *sin6 = | ||
304 | (struct sockaddr_in6 *)args->address; | ||
305 | |||
301 | servername[0] = '\0'; | 306 | servername[0] = '\0'; |
302 | switch (args->address->sa_family) { | 307 | switch (args->address->sa_family) { |
303 | case AF_INET: { | 308 | case AF_INET: |
304 | struct sockaddr_in *sin = | ||
305 | (struct sockaddr_in *)args->address; | ||
306 | snprintf(servername, sizeof(servername), "%pI4", | 309 | snprintf(servername, sizeof(servername), "%pI4", |
307 | &sin->sin_addr.s_addr); | 310 | &sin->sin_addr.s_addr); |
308 | break; | 311 | break; |
309 | } | 312 | case AF_INET6: |
310 | case AF_INET6: { | ||
311 | struct sockaddr_in6 *sin = | ||
312 | (struct sockaddr_in6 *)args->address; | ||
313 | snprintf(servername, sizeof(servername), "%pI6", | 313 | snprintf(servername, sizeof(servername), "%pI6", |
314 | &sin->sin6_addr); | 314 | &sin6->sin6_addr); |
315 | break; | 315 | break; |
316 | } | ||
317 | default: | 316 | default: |
318 | /* caller wants default server name, but | 317 | /* caller wants default server name, but |
319 | * address family isn't recognized. */ | 318 | * address family isn't recognized. */ |