Hello,

On 12:23+0100, Dec 30, 2001, Poul-Henning Kamp wrote:

>
> sys/dev/ccd/ccd.c:ccdinit() has a couple of very large items on
> the stack.
>
> Rewrite ccdinit() to allocate them with MALLOC(9) instead.

tmppath is a rather big one but I can't find the second item. What
about this patch:

Index: ccd.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ccd/ccd.c,v
retrieving revision 1.95
diff -u -r1.95 ccd.c
--- ccd.c       17 Nov 2001 00:46:08 -0000      1.95
+++ ccd.c       30 Dec 2001 12:15:25 -0000
@@ -394,7 +394,7 @@
        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 @@
         */
        maxsecsize = 0;
        minsize = 0;
+       MALLOC(tmppath, char *, 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,7 @@
                /*
                 * Copy in the pathname of the component.
                 */
-               bzero(tmppath, sizeof(tmppath));        /* sanity */
+               bzero(tmppath, MAXPATHLEN);     /* sanity */
                if ((error = copyinstr(cpaths[ix], tmppath,
                    MAXPATHLEN, &ci->ci_pathlen)) != 0) {
 #ifdef DEBUG
@@ -487,6 +488,8 @@
                ci->ci_size = size;
                cs->sc_size += size;
        }
+
+       FREE(tmppath, M_DEVBUF);

        /*
         * Don't allow the interleave to be smaller than

-- 
Maxim Konovalov, MAcomnet, Internet-Intranet Dept., system engineer
phone: +7 (095) 796-9079, mailto: [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to