public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjanv@redhat.com>
To: akpm@osdl.org, linux-scsi@vger.kernel.org
Subject: fix corruption in qla1280
Date: Mon, 14 Jul 2003 09:24:37 +0000	[thread overview]
Message-ID: <20030714092437.A4100@devserv.devel.redhat.com> (raw)

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

             reply	other threads:[~2003-07-14  9:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-14  9:24 Arjan van de Ven [this message]
2003-07-14 20:43 ` fix corruption in qla1280 Kurt Garloff
2003-07-14 21:01   ` Arjan van de Ven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030714092437.A4100@devserv.devel.redhat.com \
    --to=arjanv@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox