Otto Moerbeek wrote:
>  int
>  biosd_diskio(int rw, struct diskinfo *dip, u_int off, int nsect, void *buf)
>  {
> -     return biosd_io(rw, &dip->bios_info, off, nsect, buf);
> +     int i, n, ret;
> +
> +     /*
> +      * Avoid doing too large reads, the bounce buffer used by biosd_io()
> +      * might run us out-of-mem.
> +      */
> +     for (i = 0, ret = 0; ret == 0 && nsect > 0;
> +         i += MAXSECTS, nsect -= MAXSECTS) {
> +             n = nsect >= MAXSECTS ? MAXSECTS : nsect;
> +             ret = biosd_io(rw, &dip->bios_info, off + i, n,
> +                 buf + i * DEV_BSIZE);

you're doing pointer arithmetic on a void here. needs a cast.

or perhaps something like this, eliminating i.

        char *dest = buf;

        for (ret = 0; ret == 0; off += MAXSECTS, dest += MAXSECTS * DEV_BSIZE)

Reply via email to