X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Flnet%2Fconfig.c;h=a5661f9c3e9638e1d9d43223d7d0888ec4b99b27;hb=73c12f4d6c98476c0dc5de77a646a157db727eef;hp=7dd588e66842db7711bd83a2c8cfc77f8276bbe3;hpb=ffd8e881bb98bf3fce0716b46cc51b1922642f6e;p=fs%2Flustre-release.git diff --git a/lnet/lnet/config.c b/lnet/lnet/config.c index 7dd588e..a5661f9 100644 --- a/lnet/lnet/config.c +++ b/lnet/lnet/config.c @@ -197,7 +197,7 @@ int lnet_parse_networks(struct list_head *nilist, char *networks) { struct cfs_expr_list *el = NULL; - int tokensize = strlen(networks) + 1; + int tokensize; char *tokens; char *str; char *tmp; @@ -205,6 +205,11 @@ lnet_parse_networks(struct list_head *nilist, char *networks) __u32 net; int nnets = 0; + if (networks == NULL) { + CERROR("networks string is undefined\n"); + return -EINVAL; + } + if (strlen(networks) > LNET_SINGLE_TEXTBUF_NOB) { /* _WAY_ conservative */ LCONSOLE_ERROR_MSG(0x112, "Can't parse networks: string too " @@ -212,6 +217,8 @@ lnet_parse_networks(struct list_head *nilist, char *networks) return -EINVAL; } + tokensize = strlen(networks) + 1; + LIBCFS_ALLOC(tokens, tokensize); if (tokens == NULL) { CERROR("Can't allocate net tokens\n");