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: <20230420091102.39835-1-yijiangshan@kylinos.cn>
Date:   Thu, 20 Apr 2023 17:11:02 +0800
From:   Jiangshan Yi <yijiangshan@...inos.cn>
To:     rafael@...nel.org, robert.moore@...el.com
Cc:     lenb@...nel.org, linux-acpi@...r.kernel.org,
        acpica-devel@...ts.linuxfoundation.org,
        linux-kernel@...r.kernel.org, 13667453960@....com,
        Jiangshan Yi <yijiangshan@...inos.cn>
Subject: [PATCH v2] drivers/acpi/acpica/exserial.c: replace ternary operator with min()

Fix the following coccicheck warning:

drivers/acpi/acpica/exserial.c:346: WARNING opportunity for min().

min() macro is defined in include/linux/minmax.h. It avoids
multiple evaluations of the arguments when non-constant and performs
strict type-checking.

Link: https://github.com/acpica/acpica/pull/871
Signed-off-by: Jiangshan Yi <yijiangshan@...inos.cn>
---
 drivers/acpi/acpica/exserial.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/acpi/acpica/exserial.c b/drivers/acpi/acpica/exserial.c
index fd63f2042514..dfe507e0a09a 100644
--- a/drivers/acpi/acpica/exserial.c
+++ b/drivers/acpi/acpica/exserial.c
@@ -343,8 +343,7 @@ acpi_ex_write_serial_bus(union acpi_operand_object *source_desc,
 	/* Copy the input buffer data to the transfer buffer */
 
 	buffer = buffer_desc->buffer.pointer;
-	data_length = (buffer_length < source_desc->buffer.length ?
-		       buffer_length : source_desc->buffer.length);
+	data_length = min(buffer_length, source_desc->buffer.length);
 	memcpy(buffer, source_desc->buffer.pointer, data_length);
 
 	/* Lock entire transaction if requested */
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ