tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: options MODULAR improvements phase 0.5



On Oct 13,  9:06am, Andrew Doran wrote:
} On Fri, May 22, 2009 at 05:33:46PM -0700, John Nemeth wrote:
} 
} > @@ -558,7 +559,7 @@
} >         const int maxdepth = 6;
} >         modinfo_t *mi;
} >         module_t *mod, *mod2;
} > -       char buf[MAXMODNAME];
} > +       char buf[MAXMODNAME], *path = NULL;
} 
} KNF says to initialize automatic variables seperately, not where they are
} declared/defined.

     Hmm, okay.  I did note that several other variables were in the
declaration block, but looking again, I see they are statics and
consts.

} > @@ -616,11 +617,21 @@
} >                         depth--;
} >                         return ENOMEM;
} >                 }
} > -               error = kobj_load_file(&mod->mod_kobj, name, module_base,
} > -                   autoload);
} > +               path = PNBUF_GET();
} > +               if (!autoload) {
} > +                       snprintf(path, MAXPATHLEN - 1, "%s", name);
} 
} I think this is equivalent to strlcpy(), which of course would take
} MAXPATHLEN not MAXPATHLEN - 1.

     This was lifted straight from kobj_load_file(), which is your
code.  But, snprintf(3) confirms that snprintf() already does the '- 1'
part.

} > +kobj_load_file(kobj_t *kop, const char *path, const uint32_t flags)
} 
} The flags value is an int, IIRC.

     From namei.h, the flags argument is placed in
ndp->ni_cnd.cn_flags, and from the definition of the structure:

                uint32_t        cn_flags;       /* flags to namei */

I had already checked this.  I have changed the other things you
mentioned.

}-- End of excerpt from Andrew Doran


Home | Main Index | Thread Index | Old Index