> And some others from exec that follow a slightly different pattern. This is the pattern I have been following as well.
As for the final diff, I've been giving up on the "known constant" scenario. It seems expensive. > Index: exec_script.c > =================================================================== > RCS file: /cvs/src/sys/kern/exec_script.c,v > retrieving revision 1.30 > diff -u -p -r1.30 exec_script.c > --- exec_script.c 12 Jul 2014 18:43:32 -0000 1.30 > +++ exec_script.c 13 Jul 2014 23:46:23 -0000 > @@ -208,7 +208,7 @@ check_shell: > epp->ep_flags |= EXEC_INDIR; > > /* and set up the fake args list, for later */ > - shellargp = malloc(4 * sizeof(char *), M_EXEC, M_WAITOK); > + shellargp = mallocarray(4, sizeof(char *), M_EXEC, M_WAITOK); > tmpsap = shellargp; > *tmpsap = malloc(shellnamelen + 1, M_EXEC, M_WAITOK); > strlcpy(*tmpsap++, shellname, shellnamelen + 1); >