Re: [PATCH RESEND v2] dma-buf: heaps: use max3 in dma_heap_ioctl
From: Thorsten Blum
Date: Tue Jun 02 2026 - 18:45:17 EST
Gentle ping?
On Sun, May 17, 2026 at 07:23:53PM +0200, Thorsten Blum wrote:
> Replace two nested max() calls with a single max3() in dma_heap_ioctl().
>
> Reviewed-by: T.J. Mercier <tjmercier@xxxxxxxxxx>
> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
> ---
> Changes in v2:
> - Include minmax.h as suggested by T.J. Mercier
> - v1: https://lore.kernel.org/lkml/20260427172519.417333-3-thorsten.blum@xxxxxxxxx/
> ---
> drivers/dma-buf/dma-heap.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
> index ac5f8685a649..d49188893608 100644
> --- a/drivers/dma-buf/dma-heap.c
> +++ b/drivers/dma-buf/dma-heap.c
> @@ -13,6 +13,7 @@
> #include <linux/err.h>
> #include <linux/export.h>
> #include <linux/list.h>
> +#include <linux/minmax.h>
> #include <linux/nospec.h>
> #include <linux/syscalls.h>
> #include <linux/uaccess.h>
> @@ -153,7 +154,7 @@ static long dma_heap_ioctl(struct file *file, unsigned int ucmd,
> in_size = 0;
> if ((ucmd & kcmd & IOC_OUT) == 0)
> out_size = 0;
> - ksize = max(max(in_size, out_size), drv_size);
> + ksize = max3(in_size, out_size, drv_size);
>
> /* If necessary, allocate buffer for ioctl argument */
> if (ksize > sizeof(stack_kdata)) {