Martin Natano wrote:
> Below the conversion from uiomovei() to uiomove() for kern/tty.c and
> kern/tty_pty.c. 'cc' consistently contains small, non-negative integer
> values, so leaving the type as int should be ok. It could as well be
> changed to size_t, but I don't see a benefit in doing so for that
> particular case, except for a lot of unnecessary code churn.

Looks good. It's easy to see that cc is always > 0 when passed to
uiomove() here.
 
> Index: kern/tty.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/tty.c,v
> retrieving revision 1.127
> diff -u -p -u -r1.127 tty.c
> --- kern/tty.c        5 Dec 2015 10:11:53 -0000       1.127
> +++ kern/tty.c        13 Jan 2016 21:22:22 -0000
> @@ -1782,7 +1782,7 @@ loop:
>               if (cc == 0) {
>                       cc = MIN(uio->uio_resid, OBUFSIZ);
>                       cp = obuf;
> -                     error = uiomovei(cp, cc, uio);
> +                     error = uiomove(cp, cc, uio);
>                       if (error) {
>                               cc = 0;
>                               break;
> Index: kern/tty_pty.c
> ===================================================================
> RCS file: /cvs/src/sys/kern/tty_pty.c,v
> retrieving revision 1.74
> diff -u -p -u -r1.74 tty_pty.c
> --- kern/tty_pty.c    5 Dec 2015 10:11:53 -0000       1.74
> +++ kern/tty_pty.c    13 Jan 2016 21:22:22 -0000
> @@ -461,7 +461,7 @@ ptcread(dev_t dev, struct uio *uio, int 
>                               if (pti->pt_send & TIOCPKT_IOCTL) {
>                                       cc = MIN(uio->uio_resid,
>                                               sizeof(tp->t_termios));
> -                                     error = uiomovei(&tp->t_termios, cc, 
> uio);
> +                                     error = uiomove(&tp->t_termios, cc, 
> uio);
>                                       if (error)
>                                               return (error);
>                               }
> @@ -496,7 +496,7 @@ ptcread(dev_t dev, struct uio *uio, int 
>                       bufcc = cc;
>               if (cc <= 0)
>                       break;
> -             error = uiomovei(buf, cc, uio);
> +             error = uiomove(buf, cc, uio);
>       }
>       ttwakeupwr(tp);
>       if (bufcc)
> @@ -529,7 +529,7 @@ again:
>                               if (cc > bufcc)
>                                       bufcc = cc;
>                               cp = buf;
> -                             error = uiomovei(cp, cc, uio);
> +                             error = uiomove(cp, cc, uio);
>                               if (error)
>                                       goto done;
>                               /* check again for safety */
> @@ -553,7 +553,7 @@ again:
>                       if (cc > bufcc)
>                               bufcc = cc;
>                       cp = buf;
> -                     error = uiomovei(cp, cc, uio);
> +                     error = uiomove(cp, cc, uio);
>                       if (error)
>                               goto done;
>                       /* check again for safety */
> 
> cheers,
> natano
> 

Reply via email to