From nobody@FreeBSD.org  Mon Dec 27 05:16:26 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 41C5816A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Dec 2004 05:16:26 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 26B9943D55
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Dec 2004 05:16:26 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id iBR5GPrb074324
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Dec 2004 05:16:25 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id iBR5GPtm074322;
	Mon, 27 Dec 2004 05:16:25 GMT
	(envelope-from nobody)
Message-Id: <200412270516.iBR5GPtm074322@www.freebsd.org>
Date: Mon, 27 Dec 2004 05:16:25 GMT
From: Ken Westerback <krw@openbsd.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: aic79xx.c has two incorrect references to scb->hscb->tag instead of SCB_GET_TAG(scb)
X-Send-Pr-Version: www-2.3

>Number:         75532
>Category:       kern
>Synopsis:       [scsi] aic79xx.c has two incorrect references to scb->hscb->tag instead of SCB_GET_TAG(scb)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gibbs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 27 05:20:15 GMT 2004
>Closed-Date:    Mon Aug 15 12:55:45 GMT 2005
>Last-Modified:  Mon Aug 15 12:55:45 GMT 2005
>Originator:     Ken Westerback
>Release:        n/a
>Organization:
>Environment:
n/a
>Description:
While working to port the latest ahd code to OpenBSD I found two apparently incorrect uses of scb->hscb->tag rather than the usual define SCB_GET_TAG(scb). In the diff below I also changed the affected printf() statement to use 'SCB %d' instead of 'SCB 0x%x', as the former seems more consitantly used in displays.

While the scb->hscb->tag in the printf is operationally benign, I think the other use could cause incorrect searches of the qinfifo.
>How-To-Repeat:
      
>Fix:
Index: aic79xx.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/aic7xxx/aic79xx.c,v
retrieving revision 1.33
diff -u -r1.33 aic79xx.c
--- aic79xx.c	18 Nov 2004 20:22:30 -0000	1.33
+++ aic79xx.c	27 Dec 2004 05:07:03 -0000
@@ -9354,7 +9354,7 @@
 		lun = SCB_GET_LUN(scb);
 
 		ahd_print_path(ahd, scb);
-		printf("SCB 0x%x - timed out\n", scb->hscb->tag);
+		printf("SCB %d - timed out\n", SCB_GET_TAG(scb));
 
 		if (scb->flags & (SCB_DEVICE_RESET|SCB_ABORT)) {
 			/*
@@ -9421,7 +9421,7 @@
 			       "Identify Msg.\n", ahd_name(ahd));
 			goto bus_reset;
 		} else if (ahd_search_qinfifo(ahd, target, channel, lun,
-					      scb->hscb->tag, ROLE_INITIATOR,
+					      SCB_GET_TAG(scb), ROLE_INITIATOR,
 					      /*status*/0, SEARCH_COUNT) > 0) {
 
 			/*

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->gibbs 
Responsible-Changed-By: schweikh 
Responsible-Changed-When: Mon Dec 27 12:44:36 GMT 2004 
Responsible-Changed-Why:  
Justin, could you have a look at this? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75532 
State-Changed-From-To: open->closed 
State-Changed-By: gibbs 
State-Changed-When: Mon Aug 15 12:55:15 GMT 2005 
State-Changed-Why:  
Corrected in revision 1.35 of sys/dev/aic7xxx/aic79xx.c. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75532 
>Unformatted:
