kern/152768: [mfi] Weird check in mfi(4)

John Baldwin jhb at freebsd.org
Thu Dec 2 18:40:09 UTC 2010


The following reply was made to PR kern/152768; it has been noted by GNATS.

From: John Baldwin <jhb at freebsd.org>
To: bug-followup at freebsd.org,
 saw at online.de
Cc: scottl at freebsd.org
Subject: Re: kern/152768: [mfi] Weird check in mfi(4)
Date: Thu, 2 Dec 2010 13:30:51 -0500

 I think it should be 'ccb->csio.data_ptr[0] & 0xe0 | T_NODEVICE', or even 
 shorter would be to do this:
 
 Index: mfi_cam.c
 ===================================================================
 --- mfi_cam.c	(revision 216122)
 +++ mfi_cam.c	(working copy)
 @@ -340,14 +340,14 @@
  		ccbh->status = CAM_REQ_CMP;
  		csio->scsi_status = pt->header.scsi_status;
  		if (ccbh->flags & CAM_CDB_POINTER)
 -			command = ccb->csio.cdb_io.cdb_ptr[0];
 +			command = csio->cdb_io.cdb_ptr[0];
  		else
 -			command = ccb->csio.cdb_io.cdb_bytes[0];
 +			command = csio->cdb_io.cdb_bytes[0];
  		if (command == INQUIRY) {
 -			device = ccb->csio.data_ptr[0] & 0x1f;
 +			device = csio->data_ptr[0] & 0x1f;
  			if ((device == T_DIRECT) || (device == T_PROCESSOR))
  				csio->data_ptr[0] =
 -				     (device & 0xe0) | T_NODEVICE;
 +				     (csio->data_ptr[0] & 0xe0) | T_NODEVICE;
  		}
  		break;
  	}
 
 The intention from the code seems to be to mask T_DIRECT and T_PROCESSOR
 devices by mapping them to T_NODEVICE instead.
 
 -- 
 John Baldwin


More information about the freebsd-bugs mailing list