Currently NID string handling test for the last entry,
and last entry has .nf_type == (__u32) -1. If we ask
for a non existent LND we hit the last entry which then
calls a strlen on a NULL which causes a error. We can
avoid this problem if we just remove the last entry
since it is not used for anything except as a last
entry marker.
Signed-off-by: Frederic Saunier <frederic.saunier@atos.net>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Change-Id: Ia8e3bea0f01bb5fa78e88bfbca698b0aa0d148ea
Reviewed-on: http://review.whamcloud.com/15424
Tested-by: Jenkins
Reviewed-by: frank zago <fzago@cray.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
/* .nf_match_addr*/ cfs_ip_addr_match,
/* .nf_is_contiguous */ cfs_ip_is_contiguous,
/* .nf_min_max */ cfs_ip_min_max},
/* .nf_match_addr*/ cfs_ip_addr_match,
/* .nf_is_contiguous */ cfs_ip_is_contiguous,
/* .nf_min_max */ cfs_ip_min_max},
- /* placeholder for net0 alias. It MUST BE THE LAST ENTRY */
- {/* .nf_type */ -1},
};
static const size_t libcfs_nnetstrfns =
};
static const size_t libcfs_nnetstrfns =
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
- if (nf->nf_type >= 0 &&
- !strncmp(name, nf->nf_name, strlen(nf->nf_name)))
+ if (!strncmp(name, nf->nf_name, strlen(nf->nf_name)))
return nf;
}
return NULL;
return nf;
}
return NULL;
int i;
for (i = 0; i < libcfs_nnetstrfns; i++)
int i;
for (i = 0; i < libcfs_nnetstrfns; i++)
- if (libcfs_netstrfns[i].nf_type >= 0 &&
- !strcmp(libcfs_netstrfns[i].nf_name, name))
+ if (!strcmp(libcfs_netstrfns[i].nf_name, name))
return &libcfs_netstrfns[i];
return NULL;
return &libcfs_netstrfns[i];
return NULL;
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
- if (nf->nf_type >= 0 &&
- !strncmp(str, nf->nf_name, strlen(nf->nf_name)))
+ if (!strncmp(str, nf->nf_name, strlen(nf->nf_name)))
/* .nf_match_addr*/ cfs_ip_addr_match,
/* .nf_is_contiguous */ cfs_ip_is_contiguous,
/* .nf_min_max */ cfs_ip_min_max},
/* .nf_match_addr*/ cfs_ip_addr_match,
/* .nf_is_contiguous */ cfs_ip_is_contiguous,
/* .nf_min_max */ cfs_ip_min_max},
- /* placeholder for net0 alias. It MUST BE THE LAST ENTRY */
- {/* .nf_type */ -1},
};
static const size_t libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns);
};
static const size_t libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns);
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
- if (nf->nf_type >= 0 &&
- !strncmp(name, nf->nf_name, strlen(nf->nf_name)))
+ if (!strncmp(name, nf->nf_name, strlen(nf->nf_name)))
return nf;
}
return NULL;
return nf;
}
return NULL;
int i;
for (i = 0; i < libcfs_nnetstrfns; i++)
int i;
for (i = 0; i < libcfs_nnetstrfns; i++)
- if (libcfs_netstrfns[i].nf_type >= 0 &&
- !strcmp(libcfs_netstrfns[i].nf_name, name))
+ if (!strcmp(libcfs_netstrfns[i].nf_name, name))
return &libcfs_netstrfns[i];
return NULL;
return &libcfs_netstrfns[i];
return NULL;
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
- if (nf->nf_type >= 0 &&
- !strncmp(str, nf->nf_name, strlen(nf->nf_name)))
+ if (!strncmp(str, nf->nf_name, strlen(nf->nf_name)))