Module Name:    src
Committed By:   mlelstv
Date:           Sun Feb 23 07:54:43 UTC 2014

Modified Files:
        src/sys/kern: tty.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 src/sys/kern/tty.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/tty.c
diff -u src/sys/kern/tty.c:1.257 src/sys/kern/tty.c:1.258
--- src/sys/kern/tty.c:1.257	Sat Feb  9 00:31:21 2013
+++ src/sys/kern/tty.c	Sun Feb 23 07:54:43 2014
@@ -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 @@ int
 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:

Reply via email to