diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index 0137854a7faa..388f5773b88d 100644 --- a/net/ipv4/nexthop.c +++ b/net/ipv4/nexthop.c @@ -201,9 +201,10 @@ static int nla_put_nh_group(struct sk_buff *skb, struct nh_group *nhg) p = nla_data(nla); for (i = 0; i < nhg->num_nh; ++i) { - p->id = nhg->nh_entries[i].nh->id; - p->weight = nhg->nh_entries[i].weight - 1; - p += 1; + *p++ = (struct nexthop_grp) { + .id = nhg->nh_entries[i].nh->id, + .weight = nhg->nh_entries[i].weight - 1, + }; } return 0;