From a912a8ab0aa7934f014891b5cafa3457c515eab3 Mon Sep 17 00:00:00 2001 From: Niklas Hallqvist Date: Sat, 12 Feb 2000 09:45:50 +0000 Subject: Fix a locking bug, and a size boundary condition --- sys/dev/ic/gdt_common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/dev') 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); -- cgit v1.2.3