Martin Natano wrote:
> Below the conversion to uiomove() for ntfs. In the first three hunks the
> size passed to uiomove(i) already was of type size_t. I also converted
> the 'left' variable in ntfs_readattr() to size_t, because it tracks the
> remainder of 'rsize', which also is size_t.

Looks good. I agree with changing left to size_t. One small remark
though: size_t is defined as unsigned long. Do the DPRINTFs that print
the value of left have to be changed to use %zu in the format string?

Not sure whether the compiler warns when you specify an unsigned long
long via %llu, but pass in a long as argument.
 
> Index: ntfs/ntfs_subr.c
> ===================================================================
> RCS file: /cvs/src/sys/ntfs/ntfs_subr.c,v
> retrieving revision 1.44
> diff -u -p -u -r1.44 ntfs_subr.c
> --- ntfs/ntfs_subr.c  14 Mar 2015 03:38:52 -0000      1.44
> +++ ntfs/ntfs_subr.c  31 Jan 2016 09:44:42 -0000
> @@ -1456,7 +1456,7 @@ ntfs_writentvattr_plain(struct ntfsmount
>                               }
>                       }
>                       if (uio) {
> -                             error = uiomovei(bp->b_data + off, tocopy, uio);
> +                             error = uiomove(bp->b_data + off, tocopy, uio);
>                               if (error != 0)
>                                       break;
>                       } else
> @@ -1554,7 +1554,7 @@ ntfs_readntvattr_plain(struct ntfsmount 
>                                               return (error);
>                                       }
>                                       if (uio) {
> -                                             error = uiomovei(bp->b_data + 
> off,
> +                                             error = uiomove(bp->b_data + 
> off,
>                                                       tocopy, uio);
>                                               if (error != 0)
>                                                       break;
> @@ -1600,7 +1600,7 @@ ntfs_readntvattr_plain(struct ntfsmount 
>       } else {
>               DDPRINTF("ntfs_readnvattr_plain: data is in mft record\n");
>               if (uio) 
> -                     error = uiomovei(vap->va_datap + roff, rsize, uio);
> +                     error = uiomove(vap->va_datap + roff, rsize, uio);
>               else
>                       memcpy(rdata, vap->va_datap + roff, rsize);
>               *initp += rsize;
> @@ -1684,9 +1684,10 @@ ntfs_readattr(struct ntfsmount *ntmp, st
>       if (vap->va_compression && vap->va_compressalg) {
>               u_int8_t       *cup;
>               u_int8_t       *uup;
> -             off_t           off = roff, left = rsize, tocopy;
> +             off_t           off = roff;
>               caddr_t         data = rdata;
>               cn_t            cn;
> +             size_t          left = rsize, tocopy;
>  
>               DDPRINTF("ntfs_ntreadattr: compression: %u\n",
>                   vap->va_compressalg);
> @@ -1711,7 +1712,7 @@ ntfs_readattr(struct ntfsmount *ntmp, st
>  
>                       if (init == ntfs_cntob(NTFS_COMPUNIT_CL)) {
>                               if (uio)
> -                                     error = uiomovei(cup + off, tocopy, 
> uio);
> +                                     error = uiomove(cup + off, tocopy, uio);
>                               else
>                                       memcpy(data, cup + off, tocopy);
>                       } else if (init == 0) {
> @@ -1730,7 +1731,7 @@ ntfs_readattr(struct ntfsmount *ntmp, st
>                               if (error)
>                                       break;
>                               if (uio)
> -                                     error = uiomovei(uup + off, tocopy, 
> uio);
> +                                     error = uiomove(uup + off, tocopy, uio);
>                               else
>                                       memcpy(data, uup + off, tocopy);
>                       }
> 
> cheers,
> natano
> 

Reply via email to