Skip to contentSkip to conversation

Megaraid Patch

Linux-ia64 Michael Madore 1 participant 1 message Sep 5, 2000

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

Attached is a patch to the megaraid driver which fixes an improper cast from integer to pointer which was causing a segfault.

Mike Madore
Software Engineer
TurboLinux, Inc.

drivers/scsi/megaraid.c +8 -3
diff -Nur linux-2.4.0test7/drivers/scsi/megaraid.c linux-2.4.0test7.megaraid/drivers/scsi/megaraid.c
@@ -129,6 +129,11 @@
  *    occasionally hang. We check such cards and report them. You can
  *    get firmware upgrades to flash the board to 3.10 for free.
  *
+ * Version 1.08
+ *    Fixed bug where pointer of mbox was cast to integer in
+ *    mega_register_mailbox causing segfault. 
+ *    Aug 31 2000 Andrew Ip <[email protected]>   
+ *
  * BUGS:
  *     Some older 2.1 kernels (eg. 2.1.90) have a bug in pci.c that
  *     fails to detect the controller as a pci device on the system.
@@ -1282,13 +1287,13 @@
  *   10 01 numstatus byte
  *   11 01 status byte
  *--------------------------------------------------------------------*/
-static int mega_register_mailbox (mega_host_config * megaCfg, u32 paddr)
+static int mega_register_mailbox (mega_host_config * megaCfg, u64 paddr)
 {
   /* align on 16-byte boundry */
   megaCfg->mbox = &megaCfg->mailbox64.mailbox;
-  megaCfg->mbox = (mega_mailbox *) ((((u32) megaCfg->mbox) + 16) & 0xfffffff0);
+  megaCfg->mbox = (mega_mailbox *) ((((u64) megaCfg->mbox) + 16) & 0xfffffffffffffff0);
   megaCfg->mbox64 = (mega_mailbox64 *) (megaCfg->mbox - 4);
-  paddr = (paddr + 4 + 16) & 0xfffffff0;
+  paddr = (paddr + 4 + 16) & 0xfffffffffffffff0;
 
   /* Register mailbox area with the firmware */
   if (!(megaCfg->flag & BOARD_QUARTZ)) {