late allocation of clist in putc() and b_to_q() hasn't been required in
authorderaadt <deraadt@openbsd.org>
Wed, 1 Dec 2021 17:04:26 +0000 (17:04 +0000)
committerderaadt <deraadt@openbsd.org>
Wed, 1 Dec 2021 17:04:26 +0000 (17:04 +0000)
a decade, because all tty drivers preallocate.
ok kettenis

sys/kern/tty_subr.c

index 0f81ab6..c8bca08 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: tty_subr.c,v 1.33 2016/03/14 23:08:06 krw Exp $       */
+/*     $OpenBSD: tty_subr.c,v 1.34 2021/12/01 17:04:26 deraadt Exp $   */
 /*     $NetBSD: tty_subr.c,v 1.13 1996/02/09 19:00:43 christos Exp $   */
 
 /*
@@ -240,12 +240,8 @@ putc(int c, struct clist *clp)
        }
 
        if (clp->c_cc == 0) {
-               if (!clp->c_cs) {
-#if defined(DIAGNOSTIC)
-                       printf("putc: required clalloc\n");
-#endif
-                       clalloc(clp, 1024, 1);
-               }
+               if (!clp->c_cs)
+                       panic("%s: tty has no clist", __func__);
                clp->c_cf = clp->c_cl = clp->c_cs;
        }
 
@@ -323,12 +319,8 @@ b_to_q(u_char *cp, int count, struct clist *clp)
                goto out;
 
        if (clp->c_cc == 0) {
-               if (!clp->c_cs) {
-#if defined(DIAGNOSTIC)
-                       printf("b_to_q: required clalloc\n");
-#endif
-                       clalloc(clp, 1024, 1);
-               }
+               if (!clp->c_cs)
+                       panic("%s: tty has no clist", __func__);
                clp->c_cf = clp->c_cl = clp->c_cs;
        }