> Date: Thu, 7 Jan 2016 09:41:46 +0100
> From: Stefan Kempf <[email protected]>
> 
> Martin Natano wrote:
> > Below, a diff to convert dev/rnd.c to use uiomove().
> 
> We also did this something similar for sosend(), although uiomovei()
> would also have worked since n was guaranteed to be bounded.
> 
> OK to commit?

In the end we want to remove uiomovei(9), so ok kettenis@

> > Index: dev/rnd.c
> > ===================================================================
> > RCS file: /cvs/src/sys/dev/rnd.c,v
> > retrieving revision 1.177
> > diff -u -p -u -r1.177 rnd.c
> > --- dev/rnd.c       28 Dec 2015 05:21:53 -0000      1.177
> > +++ dev/rnd.c       1 Jan 2016 12:59:34 -0000
> > @@ -840,7 +840,7 @@ randomread(dev_t dev, struct uio *uio, i
> >     }
> >  
> >     while (ret == 0 && uio->uio_resid > 0) {
> > -           int     n = ulmin(POOLBYTES, uio->uio_resid);
> > +           size_t  n = ulmin(POOLBYTES, uio->uio_resid);
> >  
> >             if (myctx) {
> >  #ifndef KEYSTREAM_ONLY
> > @@ -849,7 +849,7 @@ randomread(dev_t dev, struct uio *uio, i
> >                     chacha_encrypt_bytes(&lctx, buf, buf, n);
> >             } else
> >                     arc4random_buf(buf, n);
> > -           ret = uiomovei(buf, n, uio);
> > +           ret = uiomove(buf, n, uio);
> >             if (ret == 0 && uio->uio_resid > 0)
> >                     yield();
> >     }
> > @@ -872,9 +872,9 @@ randomwrite(dev_t dev, struct uio *uio, 
> >     buf = malloc(POOLBYTES, M_TEMP, M_WAITOK);
> >  
> >     while (ret == 0 && uio->uio_resid > 0) {
> > -           int     n = ulmin(POOLBYTES, uio->uio_resid);
> > +           size_t  n = ulmin(POOLBYTES, uio->uio_resid);
> >  
> > -           ret = uiomovei(buf, n, uio);
> > +           ret = uiomove(buf, n, uio);
> >             if (ret != 0)
> >                     break;
> >             while (n % sizeof(u_int32_t))
> > 
> 
> 

Reply via email to