diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2021-08-04 13:23:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-08-05 11:33:50 +0100 |
commit | 4167a960574fcadc9067f4280951a35b8c021c68 (patch) | |
tree | f8785c120867e39deba2cb4a9dd9934da24e59af /net/ipv4/igmp.c | |
parent | af352460b465d7a8afbeb3be07c0268d1d48a4d7 (diff) |
net/ipv4: Revert use of struct_size() helper
Revert the use of structr_size() and stay with IP_MSFILTER_SIZE() for
now, as in this case, the size of struct ip_msfilter didn't change with
the addition of the flexible array imsf_slist_flex[]. So, if we use
struct_size() we will be allocating and calculating the size of
struct ip_msfilter with one too many items for imsf_slist_flex[].
We might use struct_size() in the future, but for now let's stay
with IP_MSFILTER_SIZE().
Fixes: 2d3e5caf96b9 ("net/ipv4: Replace one-element array with flexible-array member")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/igmp.c')
-rw-r--r-- | net/ipv4/igmp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index a5f4ecb02e97..c2d477eb6825 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c @@ -2553,8 +2553,8 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, copycount = count < msf->imsf_numsrc ? count : msf->imsf_numsrc; len = flex_array_size(psl, sl_addr, copycount); msf->imsf_numsrc = count; - if (put_user(struct_size(optval, imsf_slist_flex, copycount), optlen) || - copy_to_user(optval, msf, struct_size(optval, imsf_slist_flex, 0))) { + if (put_user(IP_MSFILTER_SIZE(copycount), optlen) || + copy_to_user(optval, msf, IP_MSFILTER_SIZE(0))) { return -EFAULT; } if (len && |