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;
__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 "
return -EINVAL;
}
+ tokensize = strlen(networks) + 1;
+
LIBCFS_ALLOC(tokens, tokensize);
if (tokens == NULL) {
CERROR("Can't allocate net tokens\n");