lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202503171021222703hl0ry06tOCRmPFcWNp5U@zte.com.cn>
Date: Mon, 17 Mar 2025 10:21:22 +0800 (CST)
From: <feng.wei8@....com.cn>
To: <sumit.semwal@...aro.org>
Cc: <benjamin.gaignard@...labora.com>, <brian.starkey@....com>,
        <jstultz@...gle.com>, <tjmercier@...gle.com>,
        <christian.koenig@....com>, <linux-media@...r.kernel.org>,
        <dri-devel@...ts.freedesktop.org>, <linaro-mm-sig@...ts.linaro.org>,
        <linux-kernel@...r.kernel.org>
Subject: [PATCH v3] dma-buf: heaps: Replace nested max() with single max3()

From: FengWei <feng.wei8@....com.cn>

Use max3() macro instead of nesting max() to simplify the return
statement.

Signed-off-by: FengWei <feng.wei8@....com.cn>
---
v2 -> v3
fix the format of this patch
 drivers/dma-buf/dma-heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c
index 3cbe87d4a464..96cb9ab5731a 100644
--- a/drivers/dma-buf/dma-heap.c
+++ b/drivers/dma-buf/dma-heap.c
@@ -147,7 +147,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)) {
-- 
2.25.1
<div class="zcontentRow"><p>From: FengWei &lt;feng.wei8@....com.cn&gt;<br></p><p><br></p><p>Use max3() macro instead of nesting max() to simplify the return</p><p>statement.</p><p><br></p><p>Signed-off-by: FengWei &lt;feng.wei8@....com.cn&gt;</p><p>---</p><p>v2 -&gt; v3</p><p>fix the format of this patch<br></p><p>&nbsp;drivers/dma-buf/dma-heap.c | 2 +-</p><p>&nbsp;1 file changed, 1 insertion(+), 1 deletion(-)</p><p><br></p><p>diff --git a/drivers/dma-buf/dma-heap.c b/drivers/dma-buf/dma-heap.c</p><p>index 3cbe87d4a464..96cb9ab5731a 100644</p><p>--- a/drivers/dma-buf/dma-heap.c</p><p>+++ b/drivers/dma-buf/dma-heap.c</p><p>@@ -147,7 +147,7 @@ static long dma_heap_ioctl(struct file *file, unsigned int ucmd,</p><p>&nbsp;<span style="white-space:pre">		</span>in_size = 0;</p><p>&nbsp;<span style="white-space:pre">	</span>if ((ucmd &amp; kcmd &amp; IOC_OUT) == 0)</p><p>&nbsp;<span style="white-space:pre">		</span>out_size = 0;</p><p>-<span style="white-space:pre">	</span>ksize = max(max(in_size, out_size), drv_size);</p><p>+<span style="white-space:pre">	</span>ksize = max3(in_size, out_size, drv_size);</p><p>&nbsp;</p><p>&nbsp;<span style="white-space:pre">	</span>/* If necessary, allocate buffer for ioctl argument */</p><p>&nbsp;<span style="white-space:pre">	</span>if (ksize &gt; sizeof(stack_kdata)) {</p><p>--&nbsp;</p><p>2.25.1</p><p style="font-size:14px;font-family:微软雅黑,Microsoft YaHei;"><br></p><p style="font-size:14px;font-family:微软雅黑,Microsoft YaHei;"><br></p><p style="font-size:14px;font-family:微软雅黑,Microsoft YaHei;"><br></p><p style="font-size:14px;font-family:微软雅黑,Microsoft YaHei;"><br></p></div>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ