Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Add a few KASSERT to verify we do not accidently us...
details: https://anonhg.NetBSD.org/src/rev/b96674493117
branches: trunk
changeset: 763974:b96674493117
user: martin <martin%NetBSD.org@localhost>
date: Sat Apr 09 12:07:06 2011 +0000
description:
Add a few KASSERT to verify we do not accidently use minor(NODEV) as an
index into the pt_softc array.
diffstat:
sys/kern/tty_pty.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diffs (42 lines):
diff -r 9ee088d2e226 -r b96674493117 sys/kern/tty_pty.c
--- a/sys/kern/tty_pty.c Sat Apr 09 11:55:59 2011 +0000
+++ b/sys/kern/tty_pty.c Sat Apr 09 12:07:06 2011 +0000
@@ -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));
Home |
Main Index |
Thread Index |
Old Index