[Prev][Next][Index][Thread]

Re: OSKit bug in partition checker



Roland,

Thanks!

> I think this bug should
> affect all extant oskit kernels when used on large disks with an extended
> partition starting past 2GB.

I agree.  This is clearly not a Mach specific problem, but I wasn't sure
what address to forward it to.  Thanks. 

> Please let me know if this alternate patch works just as well for you.

This patch works also.  I compiled and booted it just fine.
 
> Index: find_blkio.c
> ===================================================================
> RCS file: /n/moab/x/flux/CVS/oskit/diskpart/find_blkio.c,v
> retrieving revision 1.7
> diff -u -b -p -r1.7 find_blkio.c
> --- find_blkio.c        2001/02/03 06:15:06     1.7
> +++ find_blkio.c        2002/03/30 19:39:24
> @@ -24,9 +24,18 @@ blkio_read(void *arg, int start, char *b
>         oskit_size_t blksize;
>         oskit_error_t err;
>         oskit_size_t nbytes;
> +       oskit_off_t ofs;
> 
>         blksize = oskit_blkio_getblocksize(b);
> -       err = oskit_blkio_read(b, buf, start * blksize, blksize, &nbytes);
> +
> +       /*
> +        * Though start is only 32 bits, start*blksize could overflow that.
> +        * So we need to cast to oskit_off_t (64 bits) first.
> +        * As per comment below, we shift to avoid needing -lgcc for __muldi3.
> +        */
> +       ofs = (oskit_off_t)start << (ffs(blksize) - 1);
> +
> +       err = oskit_blkio_read(b, buf, ofs, blksize, &nbytes);
>         if (err)
>                 return err;
> 
-- 
Jonathan S. Arney
Software Engineer
jarney1@cox.net
------------------------------------------------------------------------
Some people call me a nihilist.
That would be true except I don't believe in nihilism.
------------------------------------------------------------------------

References: