Re: HPT372 on KR7A-RAID

From: Andy Jeffries (lkml@andyjeffries.co.uk)
Date: Thu Feb 21 2002 - 04:46:46 EST


On Thu, 21 Feb 2002 04:28:31 -0500 (EST), Alec Smith <alec@bugs.shadowstar.net> wrote:
> Did you check Andre Hedrick's IDE patches at http://www.linuxdiskcert.org?
> For unexplained reasons, the power penguins refuse to take Andre's work
> into the standard kernel even though he's the official IDE/ATA maintainer.
> Andre may have already solved your problem.

In Andre's 2.4.16 patch (from that website), the chipset_names array still
doesn't contain the HPT372 chipset and I'm guessing it will still panic
the kernel because at lines 1433-1437 of the patch it says:

+ pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
+ class_rev &= 0xff;
+
+ p += sprintf(p, "\nController: %d\n", i);
+ p += sprintf(p, "Chipset: HPT%s\n", chipset_nums[class_rev]);

Now, if the class_rev is one higher than the number of items in the array
(which it is because chipset_names is now called chipset_nums but it just
contains slightly different strings, i.e. not starting with HPT) it will
still reference an item in the array beyond bounds. A hacky patch my boss
found on the internet (he's the one with the motherboard) did the
following:

+ if(class_rev >= (sizeof(chipset_names)/sizeof(char *))) {
+ class_rev = (sizeof(chipset_names)/sizeof(char *)) - 1;
+ }

I think this is awful, but as I said, I'm not a good enough Kernel
programmer to die gracefully or depending on a passed in parameter fake it
to be the end of the chipset array (which the dirty hack above doesn't
solve, if there are two further revisions it will break again).

Kind regards,

-- 
Andy Jeffries
Linux/PHP Programmer

- Windows Crash HOWTO: compile the code below in VC++ and run it! main (){for(;;){printf("Hung up\t\b\b\b\b\b\b");}} - 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/



This archive was generated by hypermail 2b29 : Sat Feb 23 2002 - 21:00:30 EST