NetBSD Problem Report #177

From gnats  Thu Mar 24 20:01:26 1994
Received: from undergrad.math.uwaterloo.ca (root@undergrad.math.uwaterloo.ca [129.97.204.13]) by sun-lamp.cs.berkeley.edu (8.6.8/8.6.6) with SMTP id UAA03007 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Thu, 24 Mar 1994 20:01:24 -0800
Message-Id: <94Mar24.230128est.56982-1@undergrad.math.uwaterloo.ca>
Date: Thu, 24 Mar 1994 23:01:28 -0500
From: Brian de Alwis <bsdealwi@undergrad.math.uwaterloo.ca>
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: number of ports in com.c has an off-by-one error

>Number:         177
>Category:       port-i386
>Synopsis:       number of ports in com.c has an off-by-one error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 24 20:05:01 +0000 1994
>Closed-Date:    Fri Mar 25 04:38:10 +0000 1994
>Last-Modified:  Wed Sep 05 00:53:44 +0000 2001
>Originator:     Brian de Alwis
>Release:        -current to 19th March
>Organization:
"	unorganized"
>Environment:
	i386-33MHz, i387, for NetBSD/i386
System: NetBSD portia 0.9a PORTIA#4 i386


>Description:
	comopen() checks that the serial unit being accessed is a
	valid number by comparing `unit > NCOM'. `unit' is 0-relative,
	while `NCOM' is 1-relative. Thus the test should be `>='.
>How-To-Repeat:

	(x = # configured com-ports. I have 2, so x = 2)
	mknod /dev/test c 8 x
	cat /dev/test
	(kernel will panic)

>Fix:

*** /sys/arch/i386/isa/com.c	Thu Mar 24 20:59:27 1994
--- com.c	Thu Mar 24 22:08:23 1994
***************
*** 253,259 ****
  	int s;
  	int error = 0;

! 	if (unit > NCOM)
  		return ENXIO;
  	sc = &com_softc[unit];
  	if (!sc->sc_iobase)
--- 253,259 ----
  	int s;
  	int error = 0;

! 	if (unit >= NCOM)
  		return ENXIO;
  	sc = &com_softc[unit];
  	if (!sc->sc_iobase)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Thu Mar 24 20:38:10 PST 1994 
State-Changed-Why:  
Patch applied. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.