regress: use parsecmd() instead of strncmp on user pointers
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 2 May 2019 03:17:41 +0000 (23:17 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 2 May 2019 03:17:41 +0000 (23:17 -0400)
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/dev/regress.c

index fe09574..1565d57 100644 (file)
@@ -150,9 +150,12 @@ static size_t regresswrite(struct chan *c, void *a, size_t n, off64_t unused)
                nexterror();
        }
 
-       switch((int)(c->qid.path)){
+       switch ((int)(c->qid.path)) {
        case Monitorctlqid:
-               if(strncmp(a, "ktest", 5) == 0){
+               if (cb->nf < 1)
+                       error(EFAIL, "%s no command, need %s", __func__,
+                             ctlcommands);
+               if (!strcmp(cb->f[0], "ktest")) {
                        run_registered_ktest_suites();
                } else {
                        error(EFAIL, "regresswrite: only commands are %s",