public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] aacraid: regression fix
@ 2005-06-15 16:36 Mark Haverkamp
  2005-06-17 11:20 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Haverkamp @ 2005-06-15 16:36 UTC (permalink / raw)
  To: James Bottomley; +Cc: Mark Salyzyn, linux-scsi


The fixes for sparse warnings mixed in with the fixups for
the raw_srb handler resulted in a bug that showed up in the 32 bit
environments when trying to issue calls directly to the physical devices
that are part of the arrays (ioctl scsi passthrough).

Received from Mark Salyzyn at adaptec.
It applies to the scsi-misc-2.6 git tree.

Signed-off-by: Mark Haverkamp <markh@osdl.org>


diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -104,7 +104,7 @@ static int ioctl_send_fib(struct aac_dev
 		 * Since we didn't really send a fib, zero out the state to allow 
 		 * cleanup code not to assert.
 		 */
-		kfib->header.XferState = 0;
+		kfib->header.XferState = cpu_to_le32(0);
 	} else {
 		retval = fib_send(le16_to_cpu(kfib->header.Command), fibptr,
 				le16_to_cpu(kfib->header.Size) , FsaNormal,
@@ -451,7 +451,7 @@ static int aac_send_raw_srb(struct aac_d
 	 *	Allocate and initialize a Fib then setup a BlockWrite command
 	 */
 	if (!(srbfib = fib_alloc(dev))) {
-		return -1;
+		return -ENOMEM;
 	}
 	fib_init(srbfib);
 
@@ -508,7 +508,7 @@ static int aac_send_raw_srb(struct aac_d
 	default:
 		data_dir = DMA_NONE;
 	}
-	if (le32_to_cpu(srbcmd->sg.count) > (sizeof(sg_list)/sizeof(sg_list[0]))) {
+	if (user_srbcmd->sg.count > (sizeof(sg_list)/sizeof(sg_list[0]))) {
 		dprintk((KERN_DEBUG"aacraid: too many sg entries %d\n",
 		  le32_to_cpu(srbcmd->sg.count)));
 		rcode = -EINVAL;
@@ -592,7 +592,7 @@ static int aac_send_raw_srb(struct aac_d
 		struct sgmap* psg = &srbcmd->sg;
 		byte_count = 0;
 
-		actual_fibsize = sizeof (struct aac_srb) + (((le32_to_cpu(srbcmd->sg.count) & 0xff) - 1) * sizeof (struct sgentry));
+		actual_fibsize = sizeof (struct aac_srb) + (((user_srbcmd->sg.count & 0xff) - 1) * sizeof (struct sgentry));
 		if(actual_fibsize != fibsize){ // User made a mistake - should not continue
 			dprintk((KERN_DEBUG"aacraid: Bad Size specified in Raw SRB command\n"));
 			rcode = -EINVAL;
@@ -639,7 +639,7 @@ static int aac_send_raw_srb(struct aac_d
 
 	if (status != 0){
 		dprintk((KERN_DEBUG"aacraid: Could not send raw srb fib to hba\n")); 
-		rcode = -1;
+		rcode = -ENXIO;
 		goto cleanup;
 	}
 

-- 
Mark Haverkamp <markh@osdl.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] aacraid: regression fix
  2005-06-15 16:36 [PATCH] aacraid: regression fix Mark Haverkamp
@ 2005-06-17 11:20 ` Christoph Hellwig
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2005-06-17 11:20 UTC (permalink / raw)
  To: Mark Haverkamp; +Cc: James Bottomley, Mark Salyzyn, linux-scsi

On Wed, Jun 15, 2005 at 09:36:46AM -0700, Mark Haverkamp wrote:
> -		kfib->header.XferState = 0;
> +		kfib->header.XferState = cpu_to_le32(0);

you never need to byte-swap the 0 constant.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] aacraid: regression fix
@ 2005-06-17 12:15 Salyzyn, Mark
  0 siblings, 0 replies; 3+ messages in thread
From: Salyzyn, Mark @ 2005-06-17 12:15 UTC (permalink / raw)
  To: Christoph Hellwig, Mark Haverkamp; +Cc: James Bottomley, linux-scsi

But then we are requested to byteswap the 1's constant ... ;-}

Sincerely -- Mark Salyzyn

-----Original Message-----
From: Christoph Hellwig [mailto:hch@infradead.org] 
Sent: Friday, June 17, 2005 7:21 AM
To: Mark Haverkamp
Cc: James Bottomley; Salyzyn, Mark; linux-scsi
Subject: Re: [PATCH] aacraid: regression fix

On Wed, Jun 15, 2005 at 09:36:46AM -0700, Mark Haverkamp wrote:
> -		kfib->header.XferState = 0;
> +		kfib->header.XferState = cpu_to_le32(0);

you never need to byte-swap the 0 constant.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-17 12:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-15 16:36 [PATCH] aacraid: regression fix Mark Haverkamp
2005-06-17 11:20 ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2005-06-17 12:15 Salyzyn, Mark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox