Re: IDE problem?

Ivan Kokshaysky (ink@jurassic.park.msu.ru)
Mon, 17 May 1999 16:53:55 +0400


On Sun, May 16, 1999 at 05:32:21PM -0400, Mark Lord wrote:
> Rogier Wolff wrote:
> ..
> > Suppose we start with the 32 bit value:
> >
> > 0x12345678
> >
> > If I shove that in a 64 bit word and do the jumble on it, I get:
> >
> > lba_sects = 0x123456780000 | 0x1234
> > = 0x123456781234
> >
> > If I'd then truncate it to 32 bits again, you're right. But we don't
> > do that: we keep it in a 64bit variable.
>
> But of course! Better fix it then, I would imagine many Alpha's
> would have very large hard drives.. anything over 8GB triggers that code.
>
> Send Linus/Andre a patch

I don't see any reason why these variables should be `long'.

Ivan.

--- linux/drivers/block/ide-disk.c.orig Thu Mar 11 04:49:43 1999
+++ linux/drivers/block/ide-disk.c Mon May 17 16:30:45 1999
@@ -88,9 +88,9 @@
*/
static int lba_capacity_is_ok (struct hd_driveid *id)
{
- unsigned long lba_sects = id->lba_capacity;
- unsigned long chs_sects = id->cyls * id->heads * id->sectors;
- unsigned long _10_percent = chs_sects / 10;
+ u32 lba_sects = id->lba_capacity;
+ u32 chs_sects = id->cyls * id->heads * id->sectors;
+ u32 _10_percent = chs_sects / 10;

/*
* very large drives (8GB+) may lie about the number of cylinders

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