NetBSD Problem Report #41314
From www@NetBSD.org Fri May 1 02:46:57 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 1ABFD63BC38
for <gnats-bugs@gnats.netbsd.org>; Fri, 1 May 2009 02:46:57 +0000 (UTC)
Message-Id: <20090501024656.E79E863B8A5@www.NetBSD.org>
Date: Fri, 1 May 2009 02:46:56 +0000 (UTC)
From: lidl@pix.net
Reply-To: lidl@pix.net
To: gnats-bugs@NetBSD.org
Subject: missing braces in ncr53c9x.c
X-Send-Pr-Version: www-1.0
>Number: 41314
>Category: kern
>Synopsis: missing braces in ncr53c9x.c
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri May 01 02:50:00 +0000 2009
>Closed-Date: Wed May 06 01:05:37 +0000 2009
>Last-Modified: Wed May 06 01:05:37 +0000 2009
>Originator: Kurt Lidl
>Release: netbsd-5-RC4
>Organization:
>Environment:
cross-compile of netbsd-5-RC4 from solaris for a vax
I noticed the problem compiling for a vax, but it's
a MI driver.
>Description:
I whacked up a gcc 4.4.1-prerelease to build the netbsd-vax
tree. (I've not updated to netbsd-5 release, but will soon.)
Anyway, it complains thusly:
# compile GENERIC/ncr53c9x.o
/nbsd/vax-5/tools/bin/vax--netbsdelf-gcc -fno-pic -ffreestanding -fno-zero-initialized-in-bss -g -pipe -O2 -std=gnu99 -fno-strict-aliasing -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-sign-compare -Wno-pointer-sign -Wno-attributes -Werror -D_VAX_INLINE_ -I. -I/nbsd/nbsd-5/sys/../common/include -I/nbsd/nbsd-5/sys/arch -I/nbsd/nbsd-5/sys -nostdinc -DLKM -DMAXUSERS=8 -D_KERNEL -D_KERNEL_OPT -I/nbsd/nbsd-5/sys/lib/libkern/../../../common/lib/libc/quad -I/nbsd/nbsd-5/sys/lib/libkern/../../../common/lib/libc/string -I/nbsd/nbsd-5/sys/lib/libkern/../../../common/lib/libc/arch/vax/string -I/nbsd/nbsd-5/sys/dist/ipf -c /nbsd/nbsd-5/sys/dev/ic/ncr53c9x.c
cc1: warnings being treated as errors
/nbsd/nbsd-5/sys/dev/ic/ncr53c9x.c: In function 'ncr53c9x_clear':
/nbsd/nbsd-5/sys/dev/ic/ncr53c9x.c:475: error: array subscript is above array bounds
>How-To-Repeat:
Do the above compile.
>Fix:
Looking at the code, it appears that a statement was added after
a "for" line, but no set of braces was added too. I think the following
patch resolves the problem. Instead of just whacking one value
too far at the end of the array, the array is now nulled out
entirely.
Index: sys/dev/ic/ncr53c9x.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/ncr53c9x.c,v
retrieving revision 1.137
diff -u -3 -r1.137 ncr53c9x.c
--- sys/dev/ic/ncr53c9x.c 13 May 2008 22:16:27 -0000 1.137
+++ sys/dev/ic/ncr53c9x.c 30 Apr 2009 02:45:44 -0000
@@ -469,13 +469,14 @@
ecb->xs->error = result;
ncr53c9x_done(sc, ecb);
}
- for (i = 0; i < 256; i++)
+ for (i = 0; i < 256; i++) {
ecb = li->queued[i];
if (ecb != NULL) {
li->queued[i] = NULL;
ecb->xs->error = result;
ncr53c9x_done(sc, ecb);
}
+ }
li->used = 0;
}
}
>Release-Note:
>Audit-Trail:
From: Martin Husemann <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/41314 CVS commit: src/sys/dev/ic
Date: Fri, 1 May 2009 03:18:20 +0000
Module Name: src
Committed By: martin
Date: Fri May 1 03:18:20 UTC 2009
Modified Files:
src/sys/dev/ic: ncr53c9x.c
Log Message:
Add missing braces - patch from Kurt Lidl in PR port-vax/41314.
To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/ic/ncr53c9x.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: port-vax-maintainer->kern-bug-people
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Fri, 01 May 2009 03:42:31 +0000
Responsible-Changed-Why:
not vax specific
State-Changed-From-To: open->pending-pullups
State-Changed-By: martin@NetBSD.org
State-Changed-When: Fri, 01 May 2009 03:42:31 +0000
State-Changed-Why:
Waiting on pullup-5 #734
From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/41314 CVS commit: [netbsd-5] src/sys/dev/ic
Date: Sun, 3 May 2009 13:34:26 +0000
Module Name: src
Committed By: bouyer
Date: Sun May 3 13:34:25 UTC 2009
Modified Files:
src/sys/dev/ic [netbsd-5]: ncr53c9x.c
Log Message:
Pull up following revision(s) (requested by martin in ticket #734):
sys/dev/ic/ncr53c9x.c: revision 1.138
Add missing braces - patch from Kurt Lidl in PR port-vax/41314.
To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.137.8.1 src/sys/dev/ic/ncr53c9x.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/41314 CVS commit: [netbsd-5-0] src/sys/dev/ic
Date: Sun, 3 May 2009 13:36:26 +0000
Module Name: src
Committed By: bouyer
Date: Sun May 3 13:36:26 UTC 2009
Modified Files:
src/sys/dev/ic [netbsd-5-0]: ncr53c9x.c
Log Message:
Pull up following revision(s) (requested by martin in ticket #734):
sys/dev/ic/ncr53c9x.c: revision 1.138
Add missing braces - patch from Kurt Lidl in PR port-vax/41314.
To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.137.14.1 src/sys/dev/ic/ncr53c9x.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 06 May 2009 01:05:37 +0000
State-Changed-Why:
pullup completed; thanks.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.