diff --git a/include/sys/kstat.h b/include/sys/kstat.h index faf6b81dab..7862ab0a3d 100644 --- a/include/sys/kstat.h +++ b/include/sys/kstat.h @@ -32,7 +32,7 @@ #include #include -#define KSTAT_STRLEN 31 +#define KSTAT_STRLEN 255 #define KSTAT_RAW_MAX (128*1024) /* For reference valid classes are: diff --git a/module/spl/spl-kstat.c b/module/spl/spl-kstat.c index 1b6a7df9b3..3765f63cb8 100644 --- a/module/spl/spl-kstat.c +++ b/module/spl/spl-kstat.c @@ -614,21 +614,26 @@ kstat_detect_collision(kstat_t *ksp) { kstat_module_t *module; kstat_t *tmp; - char parent[KSTAT_STRLEN+1]; + char *parent; char *cp; - (void) strlcpy(parent, ksp->ks_module, sizeof(parent)); + parent = kmem_asprintf("%s", ksp->ks_module); - if ((cp = strrchr(parent, '/')) == NULL) + if ((cp = strrchr(parent, '/')) == NULL) { + strfree(parent); return (0); + } cp[0] = '\0'; if ((module = kstat_find_module(parent)) != NULL) { list_for_each_entry(tmp, &module->ksm_kstat_list, ks_list) - if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0) + if (strncmp(tmp->ks_name, cp+1, KSTAT_STRLEN) == 0) { + strfree(parent); return (EEXIST); + } } + strfree(parent); return (0); }