Re: [PATCH net v2] bonding: fix u32 overflow in compute_gap()

From: Jay Vosburgh

Date: Mon Aug 17 2026 - 12:45:17 EST


Hangbin Liu <hangbin.liu@xxxxxxxxx> wrote:

>Hi Jay,
>On Fri, Aug 14, 2026 at 01:39:23PM +0800, Hangbin Liu wrote:
[...]
>> struct alb_bond_info {
>> struct tlb_client_info *tx_hashtbl; /* Dynamically allocated */
>> - u32 unbalanced_load;
>> + s64 unbalanced_load;
>> atomic_t tx_rebalance_counter;
>> int lp_counter;
>> /* -------- rlb parameters -------- */
>
>Sashiko reported that on a 32-bit system, these s64 numbers' read/write
>operations and division will tear. We need to use div_s64() for divisions
>and may also need to convert the number to atomic64_t for read/write operations.
>
>Do you know how bonding support works on a 32-bit system? Should we handle it?

Bonding should function correctly on a 32 bit system for as long
as the base kernel continues to support 32 bit builds.

-J

---
-Jay Vosburgh, jv@xxxxxxxxxxxxx