Re: [PATCH 5/5][next] uapi: net: Avoid -Wflex-array-member-not-at-end warnings

From: Kuniyuki Iwashima
Date: Tue Oct 15 2024 - 23:52:19 EST


From: "Gustavo A. R. Silva" <gustavoars@xxxxxxxxxx>
Date: Tue, 15 Oct 2024 18:33:23 -0600
> diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
> index b068651984fe..aac82a4af36f 100644
> --- a/net/appletalk/ddp.c
> +++ b/net/appletalk/ddp.c
> @@ -1832,7 +1832,7 @@ static int atalk_compat_routing_ioctl(struct sock *sk, unsigned int cmd,
> struct rtentry rt;
>
> if (copy_from_user(&rt.rt_dst, &ur->rt_dst,
> - 3 * sizeof(struct sockaddr)) ||
> + 3 * sizeof(struct sockaddr_legacy)) ||

While at it, please fix the indent.


> get_user(rt.rt_flags, &ur->rt_flags) ||
> get_user(rt.rt_metric, &ur->rt_metric) ||
> get_user(rt.rt_mtu, &ur->rt_mtu) ||
> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
> index b24d74616637..75bd15d884e3 100644
> --- a/net/ipv4/af_inet.c
> +++ b/net/ipv4/af_inet.c
> @@ -1021,7 +1021,7 @@ static int inet_compat_routing_ioctl(struct sock *sk, unsigned int cmd,
> struct rtentry rt;
>
> if (copy_from_user(&rt.rt_dst, &ur->rt_dst,
> - 3 * sizeof(struct sockaddr)) ||
> + 3 * sizeof(struct sockaddr_legacy)) ||

Same here.

Otherwise looks good to me.

Reviewed-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>


> get_user(rt.rt_flags, &ur->rt_flags) ||
> get_user(rt.rt_metric, &ur->rt_metric) ||
> get_user(rt.rt_mtu, &ur->rt_mtu) ||