summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_ccd.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2001-12-30 17:34:19 +0000
committerphk <phk@FreeBSD.org>2001-12-30 17:34:19 +0000
commit50b47197be26605ba32347b8cf7257f1ae9420e5 (patch)
treeffd0f51887d8d89e463b5c296c95ad91fc1b9b20 /sys/geom/geom_ccd.c
parent264fac8137513dc25f5e00bcab039df0fa0774f9 (diff)
downloadFreeBSD-src-50b47197be26605ba32347b8cf7257f1ae9420e5.zip
FreeBSD-src-50b47197be26605ba32347b8cf7257f1ae9420e5.tar.gz
Reduce kernel stack usage of ccdinit() by MAXPATHLEN by using MALLOC(9).
Submitted by: Maxim Konovalov <maxim@macomnet.ru> MFC after: 1 week
Diffstat (limited to 'sys/geom/geom_ccd.c')
-rw-r--r--sys/geom/geom_ccd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c
index dc9ea96..fcf968e 100644
--- a/sys/geom/geom_ccd.c
+++ b/sys/geom/geom_ccd.c
@@ -394,7 +394,7 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td)
int maxsecsize;
struct partinfo dpart;
struct ccdgeom *ccg = &cs->sc_geom;
- char tmppath[MAXPATHLEN];
+ char *tmppath = NULL;
int error = 0;
#ifdef DEBUG
@@ -414,6 +414,7 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td)
*/
maxsecsize = 0;
minsize = 0;
+ tmppath = malloc(MAXPATHLEN, M_DEVBUF, M_WAITOK);
for (ix = 0; ix < cs->sc_nccdisks; ix++) {
vp = cs->sc_vpp[ix];
ci = &cs->sc_cinfo[ix];
@@ -422,7 +423,6 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td)
/*
* Copy in the pathname of the component.
*/
- bzero(tmppath, sizeof(tmppath)); /* sanity */
if ((error = copyinstr(cpaths[ix], tmppath,
MAXPATHLEN, &ci->ci_pathlen)) != 0) {
#ifdef DEBUG
@@ -488,6 +488,9 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td)
cs->sc_size += size;
}
+ free(tmppath, M_DEVBUF);
+ tmppath = NULL;
+
/*
* Don't allow the interleave to be smaller than
* the biggest component sector.
@@ -577,6 +580,8 @@ fail:
ci--;
free(ci->ci_path, M_DEVBUF);
}
+ if (tmppath != NULL)
+ free(tmppath, M_DEVBUF);
free(cs->sc_cinfo, M_DEVBUF);
return (error);
}
OpenPOWER on IntegriCloud