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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 20 Feb 2023 20:03:39 -0500
From:   Mohammad Mahfooz <mohammadmahfoozpersonal@...il.com>
To:     jirislaby@...nel.org
Cc:     alexander.vorwerk@...d.uni-goettingen.de,
        gregkh@...uxfoundation.org, ilpo.jarvinen@...ux.intel.com,
        johan@...nel.org, linux-kernel@...r.kernel.org,
        linux-serial@...r.kernel.org, mohammadmahfoozpersonal@...il.com
Subject: [PATCH] serial: jsm: Change n to unsigned int

Change n to an unsigned int and remove casts from min()s.

Signed-off-by: Mohammad Mahfooz <mohammadmahfoozpersonal@...il.com>
---
 drivers/tty/serial/jsm/jsm_neo.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index 4cce1e423b06..394121870436 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -277,7 +277,7 @@ static void neo_copy_data_from_uart_to_queue(struct jsm_channel *ch)
 	int qleft = 0;
 	u8 linestatus = 0;
 	u8 error_mask = 0;
-	int n = 0;
+	u32 n = 0;
 	int total = 0;
 	u16 head;
 	u16 tail;
@@ -342,15 +342,15 @@ static void neo_copy_data_from_uart_to_queue(struct jsm_channel *ch)
 			break;
 
 		/* Make sure we don't go over the end of our queue */
-		n = min(((u32) total), (RQUEUESIZE - (u32) head));
+		n = min(total, RQUEUESIZE - head);
 
 		/*
 		 * Cut down n even further if needed, this is to fix
 		 * a problem with memcpy_fromio() with the Neo on the
 		 * IBM pSeries platform.
-		 * 15 bytes max appears to be the magic number.
+		 * 12 bytes max appears to be the magic number.
 		 */
-		n = min_t(u32, n, 12);
+		n = min(n, 12U);
 
 		/*
 		 * Since we are grabbing the linestatus register, which
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ