diff mbox series

[net,1/2] net: bridge: use nla_total_size_64bit() in br_get_linkxstats_size()

Message ID 20211005010508.2194560-2-eric.dumazet@gmail.com (mailing list archive)
State Accepted
Commit dbe0b88064494b7bb6a9b2aa7e085b14a3112d44
Delegated to: Netdev Maintainers
Headers show
Series net: bridge: br_get_linkxstats_size() fixes | expand

Checks

Context Check Description
netdev/cover_letter success Series has a cover letter
netdev/fixes_present success Fixes tag present in non-next series
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers warning 2 maintainers not CCed: bridge@lists.linux-foundation.org roopa@nvidia.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Fixes tag looks correct
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Eric Dumazet Oct. 5, 2021, 1:05 a.m. UTC
From: Eric Dumazet <edumazet@google.com>

bridge_fill_linkxstats() is using nla_reserve_64bit().

We must use nla_total_size_64bit() instead of nla_total_size()
for corresponding data structure.

Fixes: 1080ab95e3c7 ("net: bridge: add support for IGMP/MLD stats and export them via netlink")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Nikolay Aleksandrov <nikolay@nvidia.com>
Cc: Vivien Didelot <vivien.didelot@gmail.com>
---
 net/bridge/br_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nikolay Aleksandrov Oct. 5, 2021, 9:03 a.m. UTC | #1
On 05/10/2021 04:05, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> bridge_fill_linkxstats() is using nla_reserve_64bit().
> 
> We must use nla_total_size_64bit() instead of nla_total_size()
> for corresponding data structure.
> 
> Fixes: 1080ab95e3c7 ("net: bridge: add support for IGMP/MLD stats and export them via netlink")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Nikolay Aleksandrov <nikolay@nvidia.com>
> Cc: Vivien Didelot <vivien.didelot@gmail.com>
> ---
>  net/bridge/br_netlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index 6c58fc14d2cb2de8bcd8364fc5e766247aba2e97..29b8f6373fb925d48ce876dcda7fccc10539240a 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -1666,7 +1666,7 @@ static size_t br_get_linkxstats_size(const struct net_device *dev, int attr)
>  	}
>  
>  	return numvls * nla_total_size(sizeof(struct bridge_vlan_xstats)) +
> -	       nla_total_size(sizeof(struct br_mcast_stats)) +
> +	       nla_total_size_64bit(sizeof(struct br_mcast_stats)) +
>  	       nla_total_size(0);
>  }
>  
> 

Good catch. Thanks,
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
diff mbox series

Patch

diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 6c58fc14d2cb2de8bcd8364fc5e766247aba2e97..29b8f6373fb925d48ce876dcda7fccc10539240a 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -1666,7 +1666,7 @@  static size_t br_get_linkxstats_size(const struct net_device *dev, int attr)
 	}
 
 	return numvls * nla_total_size(sizeof(struct bridge_vlan_xstats)) +
-	       nla_total_size(sizeof(struct br_mcast_stats)) +
+	       nla_total_size_64bit(sizeof(struct br_mcast_stats)) +
 	       nla_total_size(0);
 }