On Thu, 2025-01-16 at 08:49 +0000, Gavrilov Ilia wrote: > Since the new_metric and last_hop_metric variables can reach > the MAX_METRIC(0xffffffff) value, an integer overflow may occur > when multiplying them by 10/9. It can lead to incorrect behavior. > > Found by InfoTeCS on behalf of Linux Verification Center > (linuxtesting.org) with SVACE. > > Fixes: a8d418d9ac25 ("mac80211: mesh: only switch path when new metric is at least 10% better") > Cc: stable@xxxxxxxxxxxxxxx Seems a bit overblown for stable, but also don't really care... > +static inline bool is_metric_better(u32 x, u32 y, u32 percent) > +{ You shouldn't put inline here, in general. Also that function probably wants a comment, and the 'percent' argument is hardcoded to 10, so you don't need it. Let's keep this stuff simple, *especially* if it's for stable too ... > + if (check_add_overflow(x, a, &e)) { > + if (x > y - a) > + return false; seems simpler as "return x > y - a;" or so? johannes