Re: [PATCH] RDMA/mlx5: Use clamp() in _mlx5r_umr_zap_mkey()
From: Thorsten Blum
Date: Tue Mar 10 2026 - 15:30:39 EST
On 10. Mar 2026, at 19:47, Leon Romanovsky wrote:
> On Tue, Mar 10, 2026 at 03:57:28PM +0100, Thorsten Blum wrote:
>> Replace min(max()) with clamp(). No functional change.
>
> Are you certain about that?
> For the values to match, page_shift must be guaranteed to remain
> less or equal than max_log_size.
Yeah sorry, I didn't realize this conversion isn't straightforward.
I also just realized that clamp() is defined with if/else semantics in
linux/minmax.h, but uses min(max()) in tools/include/linux/kernel.h,
which seems confusing to me.
Nonetheless, in this case it doesn't seem safe to replace min(max())
with clamp(), and I've learned something today. Thanks for catching it,
and please drop this patch.