RE: [PATCH] megaraid driver fix for 2.5.70

Mukker, Atul (atulm@lsil.com)
Fri, 6 Jun 2003 09:28:04 -0400


> > In the memset cases, what fixed the panic was that the size of the
> > raw_mbox automatic was set to 16 and the memset was using
> > sizeof(mbox_t). I just increased the size of the raw_mbox so it
> > wouldn't be overflowed. It sounds like, from what you are
> saying, that
> > the size of raw_mbox should have been left at 16 and the
> memset changed
> > to fill 16 bytes and not the sizeof(mbox_t).
>
> Ah, that's what I couldn't find in the source, thanks.

This is correct. Driver sets up first 16 bytes and firmware sets up rest.
Busy bit is special, driver sets it and firmware clears it.

> I was also separately worried about the memcpy in the issue_scb..()
> routines which looks like it will set the mbox->busy parameter
> (controlled by the driver) to zero. So I copied Atul to see
> if this is
> a genuine problem or not.

This is ok. Driver has to set it to busy anyway.

Coming back to main issue, declaring complete mailbox would be superfluous
since driver uses 16 bytes at most. The following patch should fix the panic

--- /usr/src/linux-2.5.70/drivers/scsi/megaraid.c 2003-05-26
21:00:20.000000000 -0400
+++ megaraid.c 2003-06-06 09:14:24.000000000 -0400
@@ -4664,7 +4664,7 @@

mbox = (mbox_t *)raw_mbox;

- memset(mbox, 0, sizeof(*mbox));
+ memset(mbox, 0, 16);

memset((void *)adapter->mega_buffer, 0, MEGA_BUFFER_SIZE);

@@ -4697,7 +4697,7 @@

mbox = (mbox_t *)raw_mbox;

- memset(mbox, 0, sizeof(*mbox));
+ memset(mbox, 0, 16);

/*
* issue command to find out what channels are raid/scsi
@@ -4813,12 +4813,9 @@
mega_support_random_del(adapter_t *adapter)
{
unsigned char raw_mbox[16];
- mbox_t *mbox;
int rval;

- mbox = (mbox_t *)raw_mbox;
-
- memset(mbox, 0, sizeof(*mbox));
+ memset(raw_mbox, 0, 16);

/*
* issue command
@@ -4842,12 +4839,9 @@
mega_support_ext_cdb(adapter_t *adapter)
{
unsigned char raw_mbox[16];
- mbox_t *mbox;
int rval;

- mbox = (mbox_t *)raw_mbox;
-
- memset(mbox, 0, sizeof(*mbox));
+ memset(raw_mbox, 0, 16);
/*
* issue command to find out if controller supports extended CDBs.
*/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/