tech-kern archive

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

Re: cgdstrategy: divide fault in supervisor mode



On Wed, Sep 14, 2016 at 07:18:56AM +0100, Alexander Nasonov wrote:
> Michael van Elst wrote:
> > Ah, maybe then:
> > 
> > --- cgd.c       5 Aug 2016 08:24:46 -0000       1.110
> > +++ cgd.c       13 Sep 2016 21:43:27 -0000
> > @@ -305,13 +305,17 @@
> >  static void
> >  cgdstrategy(struct buf *bp)
> >  {
> > -       struct  cgd_softc *cs = getcgd_softc(bp->b_dev);
> > -       struct  dk_softc *dksc = &cs->sc_dksc;
> > -       struct  disk_geom *dg = &dksc->sc_dkdev.dk_geom;
> > +       struct  cgd_softc *cs;
> > +       struct  dk_softc *dksc;
> > +       struct  disk_geom *dg;
> >  
> >         DPRINTF_FOLLOW(("cgdstrategy(%p): b_bcount = %ld\n", bp,
> >             (long)bp->b_bcount));
> >  
> > +       GETCGD_SOFTC(cs, bp->b_dev);
> > +       dksc = &cs->sc_dksc;
> > +       dg = &dksc->sc_dkdev.dk_geom;
> > +
> 
> It will not compile because cgdstrategy() returns void.


Right. This needs to be written differently. Instead of GETCGD_SOFTC()
use:

	cs = getcgd_softc(bp->b_dev);
	if (!cs) {
		bp->b_error = ENXIO;
		biodone(bp);
		return;
    }

-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index