On 4/21/25 01:31, hch wrote:
On Sun, Apr 20, 2025 at 10:42:56AM -0700, Guenter Roeck wrote:
A possible local solution is below. Note the variable type change from s64 to u64.
I think that'll need a lower bound of 0 thrown in to be safe as these
counters can occasionally underflow.
Otherwise this is probably the right thing to do for now until mult_frac
gets fixed eventually. Can you add a comment why this open codes
mult_frac to the code and send a formal patch for it?
Technically only free needs to be u64 for do_div to work. But that makes
me wonder what the function is supposed to return if free < 0.
Note that the proposed 64-bit safe version of mult_frac() also requires
the dividend to be unsigned. That is a quirk of do_div().
Thanks,
Guenter