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]
Message-Id: <1466453164-13185-6-git-send-email-dave@stgolabs.net>
Date:	Mon, 20 Jun 2016 13:05:57 -0700
From:	Davidlohr Bueso <dave@...olabs.net>
To:	peterz@...radead.org, mingo@...nel.org
Cc:	davem@...emloft.net, cw00.choi@...sung.com,
	dougthompson@...ssion.com, bp@...en8.de, mchehab@....samsung.com,
	gregkh@...uxfoundation.org, pfg@....com, jikos@...nel.org,
	hans.verkuil@...co.com, awalls@...metrocast.net,
	dledford@...hat.com, sean.hefty@...el.com, kys@...rosoft.com,
	heiko.carstens@...ibm.com, James.Bottomley@...senPartnership.com,
	sumit.semwal@...aro.org, schwidefsky@...ibm.com,
	linux-kernel@...r.kernel.org, dave@...olabs.net,
	Davidlohr Bueso <dbueso@...e.de>
Subject: [PATCH 05/12] tty/serial:  Employ atomic_fetch_inc()

Now that we have fetch_inc() we can stop using inc_return() - 1.

These are very similar to the existing OP-RETURN primitives we already
have, except they return the value of the atomic variable _before_
modification.

Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Pat Gefre <pfg@....com>
Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---
 drivers/tty/serial/ioc4_serial.c | 2 +-
 drivers/tty/serial/msm_serial.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/ioc4_serial.c b/drivers/tty/serial/ioc4_serial.c
index e5c42fef69d2..5982ae159d56 100644
--- a/drivers/tty/serial/ioc4_serial.c
+++ b/drivers/tty/serial/ioc4_serial.c
@@ -974,7 +974,7 @@ intr_connect(struct ioc4_soft *soft, int type,
 	BUG_ON(!((type == IOC4_SIO_INTR_TYPE)
 	       || (type == IOC4_OTHER_INTR_TYPE)));
 
-	i = atomic_inc_return(&soft-> is_intr_type[type].is_num_intrs) - 1;
+	i = atomic_fetch_inc(&soft-> is_intr_type[type].is_num_intrs);
 	BUG_ON(!(i < MAX_IOC4_INTR_ENTS || (printk("i %d\n", i), 0)));
 
 	/* Save off the lower level interrupt handler */
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index b7d80bd57db9..a6ae591e90d3 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -1585,7 +1585,7 @@ static int msm_serial_probe(struct platform_device *pdev)
 		line = pdev->id;
 
 	if (line < 0)
-		line = atomic_inc_return(&msm_uart_next_id) - 1;
+		line = atomic_fetch_inc(&msm_uart_next_id);
 
 	if (unlikely(line < 0 || line >= UART_NR))
 		return -ENXIO;
-- 
2.6.6

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ