summaryrefslogtreecommitdiff
path: root/sys/dev/ic/gdt_common.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>2000-02-12 09:45:50 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>2000-02-12 09:45:50 +0000
commita912a8ab0aa7934f014891b5cafa3457c515eab3 (patch)
tree6a307c9805b4d2bf92b1ef2f388010b9a2d0b59a /sys/dev/ic/gdt_common.c
parentc84e669959315289e91e8d5b9ca7a38ea7767fe0 (diff)
Fix a locking bug, and a size boundary condition
Diffstat (limited to 'sys/dev/ic/gdt_common.c')
-rw-r--r--sys/dev/ic/gdt_common.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/ic/gdt_common.c b/sys/dev/ic/gdt_common.c
index 51a4d2ba48b..f409289e311 100644
--- a/sys/dev/ic/gdt_common.c
+++ b/sys/dev/ic/gdt_common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gdt_common.c,v 1.1 2000/02/07 00:33:02 niklas Exp $ */
+/* $OpenBSD: gdt_common.c,v 1.2 2000/02/12 09:45:49 niklas Exp $ */
/*
* Copyright (c) 1999, 2000 Niklas Hallqvist. All rights reserved.
@@ -121,7 +121,7 @@ gdt_attach(gdt)
for (i = 0; i < GDT_MAXCMDS; i++) {
gdt->sc_ccbs[i].gc_cmd_index = i + 2;
(void)gdt_ccb_set_cmd(gdt->sc_ccbs + i, GDT_GCF_UNUSED);
- TAILQ_INSERT_HEAD(&gdt->sc_free_ccb, &gdt->sc_ccbs[i],
+ TAILQ_INSERT_TAIL(&gdt->sc_free_ccb, &gdt->sc_ccbs[i],
gc_chain);
}
@@ -480,7 +480,7 @@ gdt_scsi_cmd(xs)
GDT_UNLOCK_GDT(gdt);
return (SUCCESSFULLY_QUEUED);
}
- GDT_LOCK_GDT(gdt);
+ GDT_UNLOCK_GDT(gdt);
switch (xs->cmd->opcode) {
case TEST_UNIT_READY:
@@ -554,7 +554,7 @@ gdt_scsi_cmd(xs)
blockcnt = _2btol(rwb->length);
}
if (blockno >= gdt->sc_hdr[target].hd_size ||
- blockno + blockcnt >= gdt->sc_hdr[target].hd_size) {
+ blockno + blockcnt > gdt->sc_hdr[target].hd_size) {
printf("%s: out of bounds %d-%d >= %d\n",
gdt->sc_dev.dv_xname, blockno, blockcnt,
gdt->sc_hdr[target].hd_size);