NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/47940: "discard" ffs mount option does not work on wedges



On Jun 17,  3:15pm, riz%NetBSD.org@localhost (riz%NetBSD.org@localhost) wrote:
-- Subject: kern/47940: "discard" ffs mount option does not work on wedges

| +     case DIOCGDISCARDPARAMS:
| +             error = VOP_IOCTL(sc->sc_parent->dk_rawvp, cmd, data, flag,
| +                               l != NULL ? l->l_cred : NOCRED);
| +             break;
| +
| +     case DIOCDISCARD: {
| +             struct disk_discard_range *dr;
| +
| +             dr = (struct disk_discard_range *)data;

The cast is not needed since data is void *.

| +#define DSIZE sc->sc_parent->dk_geom.dg_secperunit
| +             if (dr->size > (DSIZE - sc->sc_offset))
| +                 return EINVAL;
| +             if (dr->bno > DSIZE - sc->sc_offset - dr->size)
| +                 return EINVAL;
| +             dr->bno += sc->sc_offset;
| +             if (dr->bno > DSIZE)
| +                 return EINVAL;

These values are all signed so they should not be allowed to be negative.

christos


Home | Main Index | Thread Index | Old Index