Re: need help debugging a weird md/devfs problem...

Richard Gooch (rgooch@ras.ucalgary.ca)
Wed, 15 Aug 2001 11:09:12 -0600


Neil Brown writes:
> On Tuesday August 14, kevin@labsysgrp.com wrote:
> >
> > Anyone have any suggesting as to where to continue looking to find the
> > problem? I can put a workaround in to get my machine working, but there's
> > definitely something very weird going on here. Too bad I can't just tell the
> > kernel to notify me when that particular memory location gets modified...
>
> The arrays in the "struct gendisk" are only allocated big enough to
> hold any drives that were found. See init_gendisk in
> drivers/ide/ide-probe.c
>
> In your situation device 3,67 is being referenced, which is hdb3. As
> hdb was not detected, the arrays, particularly the partition array is
> not big enough to refer to that. So when disk_name does:
> hd->part[minor].de
> is it indexing off the end of an array an getting garbage.
>

I haven't looked at the closely, but if you're right, other code is
going to fall off the ends of arrays as well.

> If I am right, the following patch should fix it for you.
>
> NeilBrown
>
> --- fs/partitions/check.c 2001/08/15 04:56:57 1.1
> +++ fs/partitions/check.c 2001/08/15 04:57:47
> @@ -101,7 +101,7 @@
> int unit = (minor >> hd->minor_shift) + 'a';
>
> part = minor & ((1 << hd->minor_shift) - 1);
> - if (hd->part[minor].de) {
> + if (unit < hd->nr_real && hd->part[minor].de) {

This is definately wrong, since unit is not an index, but an ASCII
character. See the "+ 'a'" in there?

Regards,

Richard....
Permanent: rgooch@atnf.csiro.au
Current: rgooch@ras.ucalgary.ca
-
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/