# Re: \[PATCH v3 12/18\] crypto: switch af\_alg\_make\_sg() to iov\_iter

- From: Al Viro \<viro@ZenIV.linux.org.uk\>
- Date: 2015-02-09 17:28:11 
- List: netdev
- Page: https://ratatoskr.run/netdev/2015/02/8474556
- Thread: https://ratatoskr.run/netdev/2015/01/10976815/t/2.md

```text
On Mon, Feb 09, 2015 at 02:33:48PM +0100, Stephan Mueller wrote:
> > 
> > -int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len,
> > -		   int write)
> > +int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len)
> 
> Shouldn't len be size_t? iov_iter_get_pages wants a size_t. Also, the 
> invocation of af_alg_make_sg uses an unsigned variable that is provided by 
> userspace.

Keepo in mind that rw_copy_check_uvector() does, among other things,
verify that total length is less than 2^31.  So this code doesn't
suffer from wraparounds; it might make sense to switch to size_t here,
but that's a separate patch, IMO.  For this conversion I just kept
the type that used to be there.
```
