From a8dc66f457be84eefbe16e70c901ceb11137ba65 Mon Sep 17 00:00:00 2001 From: eivind Date: Fri, 8 Jan 1999 17:31:30 +0000 Subject: Split DIAGNOSTIC -> DIAGNOSTIC, INVARIANTS, and INVARIANT_SUPPORT as discussed on -hackers. Introduce 'KASSERT(assertion, ("panic message", args))' for simple check + panic. Reviewed by: msmith --- sys/dev/snp/snp.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'sys/dev/snp') diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index c4b13e5..06f17dd 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -135,10 +135,8 @@ snpread(dev, uio, flag) caddr_t from; char *nbuf; -#ifdef DIAGNOSTIC - if ((snp->snp_len + snp->snp_base) > snp->snp_blen) - panic("snoop buffer error"); -#endif + KASSERT(snp->snp_len + snp->snp_base <= snp->snp_blen, + ("snoop buffer error")); if (snp->snp_tty == NULL) return (EIO); @@ -212,10 +210,9 @@ snpin(snp, buf, n) if (n == 0) return 0; -#ifdef DIAGNOSTIC - if (n < 0) - panic("bad snoop char count"); + KASSERT(n > 0, ("negative snoop char count")); +#ifdef DIAGNOSTIC if (!(snp->snp_flags & SNOOP_OPEN)) { printf("Snoop: data coming to closed device.\n"); return 0; -- cgit v1.1