Source-Changes-HG archive

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

[src/trunk]: src/sys/kern ttioctl always gets a valid lwp reference. Replace ...



details:   https://anonhg.NetBSD.org/src/rev/1b0a11506498
branches:  trunk
changeset: 326947:1b0a11506498
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Feb 23 07:54:43 2014 +0000

description:
ttioctl always gets a valid lwp reference. Replace attempt to handle a NULL
reference in only one place with a regular assertion.

diffstat:

 sys/kern/tty.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 62f93a970d06 -r 1b0a11506498 sys/kern/tty.c
--- a/sys/kern/tty.c    Sun Feb 23 07:50:01 2014 +0000
+++ b/sys/kern/tty.c    Sun Feb 23 07:54:43 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.c,v 1.257 2013/02/09 00:31:21 christos Exp $       */
+/*     $NetBSD: tty.c,v 1.258 2014/02/23 07:54:43 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.257 2013/02/09 00:31:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.258 2014/02/23 07:54:43 mlelstv Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -927,13 +927,16 @@
 ttioctl(struct tty *tp, u_long cmd, void *data, int flag, struct lwp *l)
 {
        extern struct tty *constty;     /* Temporary virtual console. */
-       struct proc *p = l ? l->l_proc : NULL;
+       struct proc *p;
        struct linesw   *lp;
        int             s, error;
        struct pathbuf *pb;
        struct nameidata nd;
        char            infobuf[200];
 
+       KASSERT(l != NULL);
+       p = l->l_proc;
+
        /* If the ioctl involves modification, hang if in the background. */
        switch (cmd) {
        case  TIOCFLUSH:



Home | Main Index | Thread Index | Old Index