# Re: \[PATCH net v2 2/3\] net: prevent rewrite of msg\_name in sock\_sendmsg()

- From: Willem de Bruijn \<willemdebruijn.kernel@gmail.com\>
- Date: 2023-09-18 17:55:33 
- List: netdev
- Page: https://ratatoskr.run/netdev/2023/09/11272228
- Thread: https://ratatoskr.run/netdev/2023/09/11272121/t.md

```text
On Mon, Sep 18, 2023 at 1:52 PM Jordan Rife [ref] wrote:
>
> > You used this short-hand to avoid having to update all callers to sock_sendmsg to __kernel_sendmsg?
>
> Sorry about that, I misunderstood the intent. I'm fine with
> introducing a new function, doing the address copy there, and
> replacing all calls to sock_sendmsg with this wrapper. One thought on
> the naming though,
>
> To me the "__" prefix seems out of place for a function meant as a
> public interface. Some possible alternatives:
>
> 1) Rename the current kernel_sendmsg() function to
> kernel_sendmsg_kvec() and name  our new function kernel_sendmsg(). To
> me this makes some sense, considering the new function is the more
> generic of the two, and the existing kernel_sendmsg() specifically
> accepts "struct kvec".
> 2) Same as #1, but drop the old kernel_sendmsg() function instead of
> renaming it. Adapt all calls to the old kernel_sendmsg() to fit the
> new kernel_sendmsg() (this amounts to adding a
> iov_iter_kvec(&msg->msg_iter, ITER_SOURCE, vec, num, size); call in
> each spot before kernel_sendmsg() is called.

Thanks. Fair points.

Of the two proposals, I think the first is preferable, as it avoids
some non-trivial open coding in multiple callers.
```
