Second call of sysctl() is used to gather a proper size of a memory chunk

needed to hold the GEOM tree. At this point, pointer 'p' has an improper
value (as it was used previously), and we're getting EFAULT. Fix this
functionality by passing NULL instead of 'p'.

This fixes mdconfig(8) -l output with high number of md(4) devices.

   Found by:	kris
Reviewed by:	phk
This commit is contained in:
Wojciech A. Koszek 2007-05-01 10:47:09 +00:00
parent fa75abb0d2
commit 0eedd05b19
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169162

View File

@ -53,7 +53,7 @@ geom_getxml()
free(p);
}
l = 0;
i = sysctlbyname("kern.geom.confxml", p, &l, NULL, 0);
i = sysctlbyname("kern.geom.confxml", NULL, &l, NULL, 0);
if (i != 0)
return (NULL);
p = malloc(l + 4096);