public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* fix corruption in qla1280
@ 2003-07-14  9:24 Arjan van de Ven
  2003-07-14 20:43 ` Kurt Garloff
  0 siblings, 1 reply; 3+ messages in thread
From: Arjan van de Ven @ 2003-07-14  9:24 UTC (permalink / raw)
  To: akpm, linux-scsi

Hi,

In C, doing >> 32 on a 32 bit wide variable is undefined behavior, and the
code that gets generated by gcc (using the cpu shr) effectively means that
it's a nop. The patch below to qla1280.c fixes such a case, doing
>>16 twice looks more expensive but gcc optimizes it out while keeping
correct behavior.

Greetings,
   Arjan van de Ven

--- linux-2.6.0-test1/drivers/scsi/qla1280.c~	2003-07-14 11:21:51.233657418 +0200
+++ linux-2.6.0-test1/drivers/scsi/qla1280.c	2003-07-14 11:21:51.234657286 +0200
@@ -327,7 +327,7 @@
 /* 3.16 */
 #ifdef QLA_64BIT_PTR
 #define pci_dma_lo32(a)		(a & 0xffffffff)
-#define pci_dma_hi32(a)		(a >> 32)
+#define pci_dma_hi32(a)		((a >> 16)>>16)
 #else
 #define pci_dma_lo32(a)		(a & 0xffffffff)
 #define pci_dma_hi32(a)		0

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

end of thread, other threads:[~2003-07-14 20:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-14  9:24 fix corruption in qla1280 Arjan van de Ven
2003-07-14 20:43 ` Kurt Garloff
2003-07-14 21:01   ` Arjan van de Ven

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