Module Name: src
Committed By: martin
Date: Sat Apr 9 12:07:06 UTC 2011
Modified Files:
src/sys/kern: tty_pty.c
Log Message:
Add a few KASSERT to verify we do not accidently use minor(NODEV) as an
index into the pt_softc array.
To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/kern/tty_pty.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_pty.c
diff -u src/sys/kern/tty_pty.c:1.126 src/sys/kern/tty_pty.c:1.127
--- src/sys/kern/tty_pty.c:1.126 Sat Apr 9 07:02:57 2011
+++ src/sys/kern/tty_pty.c Sat Apr 9 12:07:06 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: tty_pty.c,v 1.126 2011/04/09 07:02:57 martin Exp $ */
+/* $NetBSD: tty_pty.c,v 1.127 2011/04/09 12:07:06 martin Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.126 2011/04/09 07:02:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.127 2011/04/09 12:07:06 martin Exp $");
#include "opt_ptm.h"
@@ -476,7 +476,10 @@
void
ptsstart(struct tty *tp)
{
- struct pt_softc *pti = pt_softc[minor(tp->t_dev)];
+ struct pt_softc *pti;
+
+ KASSERT(tp->t_dev != NODEV);
+ pti = pt_softc[minor(tp->t_dev)];
KASSERT(mutex_owned(&tty_lock));
@@ -497,7 +500,10 @@
void
ptsstop(struct tty *tp, int flush)
{
- struct pt_softc *pti = pt_softc[minor(tp->t_dev)];
+ struct pt_softc *pti;
+
+ KASSERT(tp->t_dev != NODEV);
+ pti = pt_softc[minor(tp->t_dev)];
KASSERT(mutex_owned(&tty_lock));