Re: [PATCH] net: Convert proto_ops::getname to sockaddr_storage

From: Marc Kleine-Budde
Date: Thu Jan 16 2025 - 02:55:14 EST


On 16.12.2024 18:34:28, Kees Cook wrote:
> The proto_ops::getname callback was long ago backed by sockaddr_storage,
> but the replacement of it for sockaddr was never done. Plumb it through
> all the getname() callbacks, adjust prototypes, and fix casts.
>
> There are a few cases where the backing object is _not_ a sockaddr_storage
> and converting it looks painful. In those cases, they use a cast to
> struct sockaddr_storage. They appear well bounds-checked, so the risk
> is no worse that we have currently.
>
> Other casts to sockaddr are removed, though to avoid spilling this
> change into BPF (which becomes a much larger set of changes), cast the
> sockaddr_storage instances there to sockaddr for the time being.
>
> In theory this could be split up into per-caller patches that add more
> casts that all later get removed, but it seemed like there are few
> enough callers that it seems feasible to do this in a single patch. Most
> conversions are mechanical, so review should be fairly easy. (Famous
> last words.)
>
> Signed-off-by: Kees Cook <kees@xxxxxxxxxx>
> ---
> net/can/isotp.c | 3 +-
> net/can/j1939/socket.c | 2 +-
> net/can/raw.c | 2 +-

Acked-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> # for net/can

regards,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |

Attachment: signature.asc
Description: PGP signature