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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 20 Jun 2016 13:06:02 -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 10/12] s390/scm_block: 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: Martin Schwidefsky <schwidefsky@...ibm.com>
Cc: Heiko Carstens <heiko.carstens@...ibm.com>
Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---
 drivers/s390/block/scm_blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c
index e6f54d3b8969..eef68990474a 100644
--- a/drivers/s390/block/scm_blk.c
+++ b/drivers/s390/block/scm_blk.c
@@ -475,7 +475,7 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev)
 	int len, ret = -ENOMEM;
 	unsigned int devindex, nr_max_blk;
 
-	devindex = atomic_inc_return(&nr_devices) - 1;
+	devindex = atomic_fetch_inc(&nr_devices);
 	/* scma..scmz + scmaa..scmzz */
 	if (devindex > 701) {
 		ret = -ENODEV;
-- 
2.6.6

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ